Skip to content

Instantly share code, notes, and snippets.

@costdev
Last active February 9, 2024 19:13
Show Gist options
  • Save costdev/2566d68d6ebc1083d0ad127af3e399c7 to your computer and use it in GitHub Desktop.
Save costdev/2566d68d6ebc1083d0ad127af3e399c7 to your computer and use it in GitHub Desktop.
Rollback Auto-updates: Testing plugin and instructions.

Setup

  1. Apply the PR or download and install the feature plugin. Do not do both. Note that the feature plugin has limitations as there are Core changes in the PR that aren't possible with a feature plugin.
  2. Enable WP_DEBUG and WP_DEBUG_LOG.
  3. Create and open wp-content/debug.log in your IDE, so that it will populate with new entries as they are logged.
  4. Download, install and enable auto-updates for these plugins.
  5. For Git Updater, ensure you navigate to Settings > Git Updater, click Activate free version, then click Skip.
  6. Un-bump the version of one of the site's themes and navigate to Appearance > Themes, then click the theme and enable auto-updates.

Testing

  1. Run the following command:
wp option delete auto_updater.lock; wp option delete pwccfast-wp_version_check; wp option delete pwccfast-wp_update_plugins; wp option delete pwccfast-wp_update_themes; wp option delete pwccfast-wp_maybe_auto_update; wp cron event delete wp_version_check; wp cron event delete wp_update_plugins; wp cron event delete wp_update_themes;
  1. Navigate to Plugins > Installed plugins. You'll see beside each plugin that there's less than 60 seconds until the next auto-update run.
  2. Keep refreshing every so often until the timer has about 5 seconds left. Wait 7 seconds to ensure it's done, then refresh once more.
  3. If using the feature plugin: Once the first entries appear in debug.log, do not refresh or browse the site
  4. If using the PR: Once the first entries appear in debug.log, refresh and browse the site like you don't care about getting RSI.

Expected Results

Once debug.log says that automatic updates have completed, you should observe:

  • Despite any non-persistent fatal errors, all plugins have updated, except those whose updates contain persistent fatal errors.
  • The theme you un-bumped has updated.
  • MailPoet may be deactivated (a previously existing issue, not this feature's).
  • wp-content/upgrade/ will be empty.
  • wp-content/upgrade-temp-backup/plugins will be empty. However, this is done on 'shutdown', so be patient with this bit.
  • wp-content/upgrade-temp-backup/themes will be empty. See above.
  • If you're set up for emails, you should receive an auto-update email that also includes entries for the plugins with fatal errors that were rolled back.

Known Issues

  • MailPoet will likely update before WooCommerce. This will likely throw an error temporarily, but is no reason to roll back.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment