[wp-trac] [WordPress Trac] #51857: Add rollback for failed plugin/theme updates
WordPress Trac
noreply at wordpress.org
Fri Aug 20 14:50:10 UTC 2021
#51857: Add rollback for failed plugin/theme updates
----------------------------------------------+----------------------------
Reporter: pbiron | Owner: pbiron
Type: enhancement | Status: reopened
Priority: normal | Milestone: Future
| Release
Component: Upgrade/Install | Version:
Severity: normal | Resolution:
Keywords: early has-patch has-testing-info | Focuses:
----------------------------------------------+----------------------------
Changes (by Boniu91):
* keywords: early has-patch => early has-patch has-testing-info
Comment:
Copying testing instructions from the PR:
* If the `wp-content/temp-backup` folder is not writable, there should be
an error in the site-health screen.
* If the server has less than 20MB available, there should be an error in
the site-health screen that updates may fail. If the server has less than
100MB, it should be a notice that disk space is running low.
* When updating a plugin, you should be able to see the old plugin in the
`wp-content/upgrade/temp-backup/plugins/PLUGINNAME` folder. The same
should apply for themes. Since updates sometimes run fast and we may miss
the folder creation during testing, you can add `return true;` as the 1st
line inside the `WP_Upgrader->delete_temp_backup()` method. This will
return early and skip deleting the backup on update-success.
* When a plugin update fails, the previous version should be restored. To
test that, change the version of a plugin to a previous number, run the
update, and on fail the previous version (the one where you changed the
version number) should still be installed on the site. To simulate an
update failure and confirm this works, you can use the snippet below:
{{{
add_filter( 'upgrader_install_package_result', function() {
return new WP_Error( 'simulated_error', 'Simulated Error' );
});
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/51857#comment:101>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list