Upgrade/Install: Clean up working directory after installation failure#12676
Upgrade/Install: Clean up working directory after installation failure#12676ArkaPrabhaChowdhury wants to merge 5 commits into
Conversation
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
There was a problem hiding this comment.
Pull request overview
This PR addresses upgrade/install cleanup by ensuring the extracted working directory is removed when WP_Upgrader::install_package() fails and clear_working is enabled, and adds a regression test covering that failure path.
Changes:
- Delete the unpacked working directory in
WP_Upgrader::run()wheninstall_package()returns aWP_Errorandclear_workingis true. - Add a PHPUnit regression test to assert the working directory cleanup occurs on installation failure.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/wp-admin/includes/class-wp-upgrader.php | Adds working directory cleanup in WP_Upgrader::run() for the WP_Error failure path when clear_working is enabled. |
| tests/phpunit/tests/admin/wpUpgrader.php | Adds a regression test asserting run() deletes the working directory when install_package() fails. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
| $actual = $instance->run( | ||
| array( | ||
| 'package' => '/tmp/test-package.zip', | ||
| 'destination' => WP_PLUGIN_DIR, | ||
| 'is_multi' => true, | ||
| ) | ||
| ); |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Trac ticket: https://core.trac.wordpress.org/ticket/44710
Ensures extracted upgrade working directories are removed when package installation fails and clear_working is enabled. Adds focused regression coverage for the failure path.
Tests: phpunit tests/phpunit/tests/admin/wpUpgrader.php (108 tests, 347 assertions).