Skip to content

Use Utils\make_temp_file() for the download temp path #189

Description

@schlessera

wp-cli/wp-cli#6374 added Utils\make_temp_file() and Utils\make_temp_dir() (merged to main, milestone 3.0.0). This package still builds one temporary path by hand:

  • src/WP_CLI/LanguagePackUpgrader.php:102: \WP_CLI\Utils\get_temp_dir() . uniqid( 'wp_' ) . '.' . $ext

Switch it to \WP_CLI\Utils\make_temp_file( 'wp_', '.' . $ext ). The path is only used on the cache-hit branch (copy( $cache_file, $temp )); on a cache miss download_url() replaces it. Since the helper creates the file, call it inside the cache-hit branch, otherwise every cache miss leaves an empty file behind.

Blocked on a wp-cli/wp-cli release that ships the helpers. composer.json already requires wp-cli/wp-cli ^3.0.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions