Skip to content

Use Utils\make_temp_file() only on translation cache hits - #190

Draft
schlessera with Copilot wants to merge 2 commits into
mainfrom
copilot/use-utils-make-temp-file
Draft

Use Utils\make_temp_file() only on translation cache hits#190
schlessera with Copilot wants to merge 2 commits into
mainfrom
copilot/use-utils-make-temp-file

Conversation

Copilot AI commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

This updates language-pack download temp-path handling to use the WP-CLI temp-file helper and avoid creating unused empty temp files on cache misses. The temp file is now created only when a cached artifact is actually copied.

  • Download temp file lifecycle

    • Removed manual temp path construction (get_temp_dir() . uniqid(...)).
    • Moved temp file creation into the cache-hit branch.
    • Switched to \WP_CLI\Utils\make_temp_file( 'wp_', '.' . $ext ) before copy( $cache_file, $temp ).
  • Behavioral coverage

    • Added a focused Behat core-language scenario to exercise reinstall-from-cache and assert the cached path is used (Using cached file ...).
if ( $cache_file ) {
	$temp = \WP_CLI\Utils\make_temp_file( 'wp_', '.' . $ext );
	WP_CLI::log( "Using cached file '$cache_file'..." );
	copy( $cache_file, $temp );
	return $temp;
}

@coderabbitai

coderabbitai Bot commented Sep 11, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 7482138e-e08a-4245-ac73-96606247afbc

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Co-authored-by: schlessera <83631+schlessera@users.noreply.github.com>
Copilot AI changed the title [WIP] Update LanguagePackUpgrader to use Utils\make_temp_file() Use Utils\make_temp_file() only on translation cache hits Sep 11, 2026
Copilot AI requested a review from schlessera September 11, 2026 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use Utils\make_temp_file() for the download temp path

2 participants