Skip to content

Replace manual temp path construction with Utils\make_temp_file() - #346

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 core-command to use WP-CLI’s new temp-file helper instead of hand-built get_temp_dir() . uniqid() paths. The goal is to align with the newer API that creates temp files safely up front while keeping existing cleanup behavior unchanged.

  • Scope: core download/update temp files
    • Swapped manual temp path generation in:
      • src/Core_Command.php (download temp .tmp)
      • src/Core_Command.php (skip-content working .zip)
      • src/WP_CLI/Core/CoreUpgrader.php (downloaded package extension)
  • Behavioral intent
    • Preserve existing control flow and shutdown cleanup handlers.
    • Change only the temp-file creation mechanism.
// Before
$temp = Utils\get_temp_dir() . uniqid( 'wp_' ) . '.tmp';

// After
$temp = Utils\make_temp_file( 'wp_', '.tmp' );

@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: 5f44fb12-9ed9-4976-9a3f-54c819b63d9e

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.

Copilot AI linked an issue Sep 11, 2026 that may be closed by this pull request
Co-authored-by: schlessera <83631+schlessera@users.noreply.github.com>
Copilot AI changed the title [WIP] Update temporary path generation to use Utils\make_temp_file() Replace manual temp path construction with Utils\make_temp_file() Sep 11, 2026
Copilot AI requested a review from schlessera September 11, 2026 21:58
@swissspidy swissspidy added this to the 3.0.2 milestone Sep 14, 2026
@swissspidy
swissspidy marked this pull request as ready for review September 14, 2026 06:30
@swissspidy
swissspidy requested a review from a team as a code owner September 14, 2026 06:30
Copilot AI lite review requested due to automatic review settings September 14, 2026 06:30

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

No unresolved issues were identified, and existing cleanup behavior is preserved.

Pull request overview

Replaces manual temporary-path construction with Utils\make_temp_file() for core downloads and updates while preserving cleanup behavior.

Changes:

  • Updated download and skip-content temporary files.
  • Updated core upgrader package temporary files.
  • Preserved existing cleanup handlers.
File summaries
File Description
src/WP_CLI/Core/CoreUpgrader.php Uses Utils\make_temp_file() for downloaded packages.
src/Core_Command.php Uses the helper for downloads and ZIP processing.
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 merged commit b3d2b5d into main Sep 14, 2026
52 checks passed
@swissspidy
swissspidy deleted the copilot/use-utils-make-temp-file branch September 14, 2026 06:43
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 temporary paths

4 participants