keycdn / cache-enabler

A lightweight caching plugin for WordPress that makes your website faster by generating static HTML files.
https://wordpress.org/plugins/cache-enabler/
123 stars 46 forks source link

update plugin upgrade process for multisites #303

Closed coreykn closed 3 years ago

coreykn commented 3 years ago

Update the process for when the disk and backend requirements are updated for multisite networks to not all be done at once because that does not scale well.

There is a caveat of this change and it is related to the cache_enabler_disk_updated site transient. An edge case could arise when this plugin is used on a multisite network as a must-use plugin, so there is no activation/deactivation/uninstalling occurring, and the following occurs within an hour:

  1. Update plugin.
  2. Forcefully delete the plugin (e.g. SFTP or FTP).
  3. Install an older version of the plugin.
  4. Update the plugin to the same version as in step 1.

The edge case would be the disk requirements would not be updated because the site transient would still exist thinking it already updated itself. The caveats of a must-use plugin itself makes handling that specific scenario a little tricky with what is currently available in the plugin. This can actually also occur when not a must-use plugin if switching between plugin versions with the plugin installer and never deactivating->manual update->activating the plugin. Quite rare and unlikely but I thought I would put it out there that this can occur as of this commit. Once a new queue system is introduced shortly it will not as we'll have new behavior that can prevent those types of edge cases related to that site transient and uncommon update sequences.