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

add site cache clearing #167

Closed coreykn closed 3 years ago

coreykn commented 3 years ago

Add cache clearing behavior to clear the site cache. Update most places with this new behavior instead of clearing the complete cache. This fixes a couple issues in multisite networks, like how the settings for one site can clear the complete network cache, regardless of how other sites are configured. The same could happen when choosing to clear the cache when saving the settings on any site in the network. The changes introduced to Cache_Enabler::clear_site_cache_by_blog_id() in PR #164 allows this to be handled in one way for both single and multisite installations. This change will reduce how often the ce_action_cache_cleared action hook is being fired, however, the upcoming hook changes will take this into account and will improve indicating what has actually been cleared.

Remove clearing the cache from Cache_Enabler::on_uninstall() because this is done on plugin deactivation.

Remove error control operator when scanning the directory in Cache_Enabler_Disk::get_dir_objects() because checking if the directory exists now always occurs before this method is called. This has not been added to the method itself as there are currently a few methods that rely on whether or not the directory about to be scanned exists.