Skip to content

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

Merged
swissspidy merged 2 commits into
mainfrom
copilot/use-utils-make-temp-file
Sep 14, 2026
Merged

swissspidy merged 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: e37e719a-2095-4bae-80d9-6f1fe35662cb

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
@swissspidy
swissspidy marked this pull request as ready for review September 14, 2026 06:31
@swissspidy
swissspidy requested a review from a team as a code owner September 14, 2026 06:31
Copilot AI lite review requested due to automatic review settings September 14, 2026 06:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The changes are covered by focused tests and have no unresolved blocking issues.

Pull request overview

Updates language-pack downloads to create temporary files only when copying cached artifacts.

Changes:

  • Replaces manual temp-path construction with make_temp_file().
  • Adds Behat coverage for cached language installation.
File summaries
File Description
src/WP_CLI/LanguagePackUpgrader.php Defers temp-file creation to cache hits.
features/language-core.feature Verifies cached language installation.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@codecov

codecov Bot commented Sep 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@swissspidy swissspidy added this to the 3.0.1 milestone Sep 14, 2026
@swissspidy
swissspidy merged commit b76b935 into main Sep 14, 2026
52 checks passed
@swissspidy
swissspidy deleted the copilot/use-utils-make-temp-file branch September 14, 2026 07:01
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

4 participants