wp-cli/wp-cli#6374 added Utils\make_temp_file() and Utils\make_temp_dir() (merged to main, milestone 3.0.0). src/Package_Command.php still builds temporary paths by hand:
- line 279:
Utils\get_temp_dir() . uniqid( 'wp-cli-package_', true ) . '.zip' for the downloaded ZIP
- line 294:
Utils\get_temp_dir() . uniqid( 'wp-cli-package_', true ) for the extraction directory
Switch them to Utils\make_temp_file( 'wp-cli-package_', '.zip' ) and Utils\make_temp_dir( 'wp-cli-package_' ). Two things to check on the way: make_temp_dir() creates the directory (mode 0700) before Extractor::extract() runs, so the extractor gets an existing empty directory instead of creating it, and it returns the path with a trailing slash, which the later get_package_name_and_version_from_dir_package(), copy_overwrite_files() and rmdir() calls receive.
Blocked on a wp-cli/wp-cli release that ships the helpers. composer.json already requires wp-cli/wp-cli ^3.0.
wp-cli/wp-cli#6374 added
Utils\make_temp_file()andUtils\make_temp_dir()(merged to main, milestone 3.0.0).src/Package_Command.phpstill builds temporary paths by hand:Utils\get_temp_dir() . uniqid( 'wp-cli-package_', true ) . '.zip'for the downloaded ZIPUtils\get_temp_dir() . uniqid( 'wp-cli-package_', true )for the extraction directorySwitch them to
Utils\make_temp_file( 'wp-cli-package_', '.zip' )andUtils\make_temp_dir( 'wp-cli-package_' ). Two things to check on the way:make_temp_dir()creates the directory (mode 0700) beforeExtractor::extract()runs, so the extractor gets an existing empty directory instead of creating it, and it returns the path with a trailing slash, which the laterget_package_name_and_version_from_dir_package(),copy_overwrite_files()andrmdir()calls receive.Blocked on a wp-cli/wp-cli release that ships the helpers.
composer.jsonalready requireswp-cli/wp-cli ^3.0.