Over the past month, @aristath and @sergeybiryukov have been working on a proof of concept to solve the two first outcomes highlighted in the Updater Initiative scope post.
They drew inspiration from the https://wordpress.org/plugins/rollback-update-failure/ plugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party and tried to address a few tickets.
They created a proof of concept that can be found in a draft PR on https://github.com/WordPress/wordpress-develop/pull/1492/files and does the following:
- Add new arguments to
hook_extra passed by plugin and theme updates to ensure we can rollback to the correct version.
- After a plugin/theme is successfully downloaded and extracted, the old plugin/theme folder is moved to
wp-content/upgrade/rollback/themes/THEME (thanks Paul Bigai for catching that)
- If the plugin/theme was successfully installed, the backup of the previous version we kept in
wp-content/upgrade/rollback/ is deleted.
- If the plugin/theme was not successfully installed, then we cleanup any remnants of files in
wp-content/plugins/PLUGIN (or the corresponding folder for themes), and then we move the backup we kept in the rollbacks folder back to its original location.
- Adds info in the site-health screen, to make sure the rollback folder is writable (or can be created if it doesn’t exist)
That is the basic concept. The team ran some tests, helped by @peona as well and it seems to be working.
The main difference with the
rollback-update-failure plugin is that this solution moves the plugin/theme folders instead of zipping/unzipping them. This change should help to make the implementation a bit lighter/safer on shared hosts with limited resources.
Before moving forward, I would like to ask the Upgrade/Install Maintainers to have a look at this and discuss together, in the comments of this post, if you agree with this change, if it works, etc…
I am not setting a deadline for the comments, but ideally, I would like to be able to write a merge proposal for 5.9 so I will review the post in mid-
JulyAugust (thanks @meher for pointing out that we are at the end of July already 😂) and nudge a bit more 😉
Thank you all for your help and feedback!
Thanks @ipstenu for the peer review