Rollback Update Failure

Beschreibung

This is a feature plugin based on the PR for #51857.

  • When updating a plugin/theme, the old version of the plugin/theme gets moved to a wp-content/upgrade/temp-backup/plugins/PLUGINNAME or wp-content/upgrade/temp-backup/themes/THEMENAME folder. The reason we chose to move instead of zip, is because zipping/unzipping are very resources-intensive processes, and would increase the risk on low-end, shared hosts. Moving on the other hand is performed instantly and won’t be a bottleneck.
  • If the update fails, then the „backup“ we kept in the upgrade/temp-backup folder gets restored to its original location
  • If the update succeeds, then the „backup“ is deleted
  • 2 new checks were added in the site-health screen:
    • Check to make sure that the rollbacks folder is writable.
    • Check there is enough disk-space available to safely perform updates.

To avoid confusion: The „temp-backup“ folder will NOT be used to „roll-back“ a plugin to a previous version after an update. This folder will simply contain a transient backup of the previous version of a plugins/themes getting updated, and as soon as the update process finishes, the folder will be empty.

This plugin will automatically deactivate itself once the feature has been committed to core.

Testing

  • 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' );
    });
    

Alternatively you can install the Rollback Update Testing plugin, activating it as needed.

Reporting

Please submit issues and PRs to GitHub.

Rezensionen

14. Juli 2021
That is great! I have just one question! How many times this plugin could roll back a theme or a plugin update, can it roll back for example three steps back? Thank you for your answer in advance!
Lies alle 2 Rezensionen

Mitwirkende & Entwickler

„Rollback Update Failure“ ist Open-Source-Software. Folgende Menschen haben an diesem Plugin mitgewirkt:

Mitwirkende

„Rollback Update Failure“ wurde in 6 Sprachen übersetzt. Danke an die Übersetzerinnen und Übersetzer für ihre Mitwirkung.

Übersetze „Rollback Update Failure“ in deine Sprache.

Interessiert an der Entwicklung?

Durchstöbere den Code, sieh dir das SVN Repository an oder abonniere das Entwicklungsprotokoll per RSS.

Änderungsprotokoll

Please see the Github repository: CHANGELOG.md.

1.1.3 / 2021-09-17

  • update version check

1.1.1 / 2021-09-07

  • update check for disk_free_space()

1.1.0 / 2021-09-01

  • automatically deactivate plugin after feature committed to core, currently set to 5.9-beta1
  • check for disabled function disk_free_space() and degrade gracefully

1.0.0 / 2021-08-30

  • updated to be on par with PR #1492, thanks @aristah
  • original zip rollback is now branch zip-rollback

0.5.3 / 2021-07-01

  • add @10up GitHub Actions integration for WordPress SVN

0.5.2 / 2021-06-10

  • exit early if $hook_extra is empty

0.5.1 / 2021-03-15

  • update error message for installation not update

0.5.0 / 2021-02-10

  • initial commit
  • use simpler hook for extract_rollback
  • update for upgrader_install_package_result filter and parameters passed
  • add text domain
  • update error message display
  • added filter rollback_update_testing to simulate a failure.
  • override filter if there’s already a WP_Error