diff --git a/src/Core_Command.php b/src/Core_Command.php index 7fe7e9d0..9cb0a0b9 100644 --- a/src/Core_Command.php +++ b/src/Core_Command.php @@ -298,7 +298,7 @@ public function download( $args, $assoc_args ) { } if ( ! $cache_file || $bad_cache ) { - $temp = Utils\get_temp_dir() . uniqid( 'wp_' ) . '.tmp'; + $temp = Utils\make_temp_file( 'wp_', '.tmp' ); register_shutdown_function( function () use ( &$temp ) { if ( file_exists( $temp ) ) { @@ -2242,7 +2242,7 @@ private function remove_directory( $dir, $abspath_realpath_trailing ) { } private static function strip_content_dir( $zip_file ) { - $new_zip_file = Utils\get_temp_dir() . uniqid( 'wp_' ) . '.zip'; + $new_zip_file = Utils\make_temp_file( 'wp_', '.zip' ); register_shutdown_function( function () use ( $new_zip_file ) { if ( file_exists( $new_zip_file ) ) { diff --git a/src/WP_CLI/Core/CoreUpgrader.php b/src/WP_CLI/Core/CoreUpgrader.php index d8b266c3..56623f40 100644 --- a/src/WP_CLI/Core/CoreUpgrader.php +++ b/src/WP_CLI/Core/CoreUpgrader.php @@ -84,7 +84,7 @@ public function download_package( $package, $check_signatures = false, $hook_ext $filename = pathinfo( $package, PATHINFO_FILENAME ); $extension = pathinfo( $package, PATHINFO_EXTENSION ); - $temp = Utils\get_temp_dir() . uniqid( 'wp_' ) . ".{$extension}"; + $temp = Utils\make_temp_file( 'wp_', ".{$extension}" ); register_shutdown_function( function () use ( $temp ) { if ( file_exists( $temp ) ) {