Update wpmu_new_blog action hook with wp_initialize_site because it has been deprecated since WordPress version 5.1.0. Update delete_blog action hook with wp_uninitialize_site because it has been deprecated since WordPress version 5.1.0. This makes the new minimum WordPress version 5.1. Update the CE_MIN_WP constant to 5.1.
Update Cache_Enabler::on_ce_activation_deactivation() to only clear the complete cache once.
Update Cache_Enabler::on_uninstall() to clear the complete cache instead of Cache_Enabler::_uninstall_backend(). This avoids unnecessarily clearing the complete cache multiple times when Cache Enabler in uninstalled on a network installation.
Update Cache_Enabler::uninstall_later():
Do not use the switch_to_blog() function because switching to a blog that has been deleted will not work.
Only clear the complete cache of the deleted site in the network instead of the complete cache.
Remove Cache_Enabler::_uninstall_backend() because the table with the Cache Enabler option is dropped when a site is deleted.
Update clear request processing:
Update the "Clear Cache" admin bar button to be "Clear Network Cache" if on network admin interface.
Clear the complete network cache if performed from network admin interface. Previously only the main site cache would be cleared.
Update the clear request URL query parameters naming to improve understanding of functionality.
Add clear ID to check and prevent the same clear request from processing twice. This is done by adding a unix timestamp as a URL query parameter and setting a cookie with that timestamp. If the timestamp in the URL matches the cookie value before being set then the request is not processed. Previously the clear request could be processed on a page refresh until the nonce expired, which could lead to unwanted clear requests.
Fix cache clearing behavior on a multisite network with the subdirectory configuration. Previously when the "Clear Cache" admin bar button was clicked the complete network cache would be cleared. Now only the specific site cache will be cleared. This was already the current behavior on a multisite network with the subdomain configuration.
Update type validations to use is_int() and is_string() to improve code readability (e.g. instead of ! $var = (string) $var).
Update Cache_Enabler_Disk::_file_path() to use get_site_url(). This is required to properly clear the cache by URL when installed on a network installation. Previously when network activated and a new site was created the hostname of the network admin was used instead of the current blog.
Add CE_SETTINGS_PATH constant for advanced cache settings file path.
Add Cache_Enabler::clear_blog_id_cache() to clear the complete cache of a blog in a network installation by the blog ID (for both subdomain and subdirectory configurations).
Add Cache_Enabler::get_blog_domain() so both Cache_Enabler_Disk::_get_settings() and Cache_Enabler::clear_blog_id_cache() use the same method to get the blog domain.
Update
wpmu_new_blog
action hook withwp_initialize_site
because it has been deprecated since WordPress version 5.1.0. Updatedelete_blog
action hook withwp_uninitialize_site
because it has been deprecated since WordPress version 5.1.0. This makes the new minimum WordPress version 5.1. Update theCE_MIN_WP
constant to 5.1.Update
Cache_Enabler::on_ce_activation_deactivation()
to only clear the complete cache once.Update
Cache_Enabler::on_uninstall()
to clear the complete cache instead ofCache_Enabler::_uninstall_backend()
. This avoids unnecessarily clearing the complete cache multiple times when Cache Enabler in uninstalled on a network installation.Update
Cache_Enabler::uninstall_later()
:Do not use the
switch_to_blog()
function because switching to a blog that has been deleted will not work.Only clear the complete cache of the deleted site in the network instead of the complete cache.
Remove
Cache_Enabler::_uninstall_backend()
because the table with the Cache Enabler option is dropped when a site is deleted.Update clear request processing:
Update the "Clear Cache" admin bar button to be "Clear Network Cache" if on network admin interface.
Clear the complete network cache if performed from network admin interface. Previously only the main site cache would be cleared.
Update the clear request URL query parameters naming to improve understanding of functionality.
Add clear ID to check and prevent the same clear request from processing twice. This is done by adding a unix timestamp as a URL query parameter and setting a cookie with that timestamp. If the timestamp in the URL matches the cookie value before being set then the request is not processed. Previously the clear request could be processed on a page refresh until the nonce expired, which could lead to unwanted clear requests.
Fix cache clearing behavior on a multisite network with the subdirectory configuration. Previously when the "Clear Cache" admin bar button was clicked the complete network cache would be cleared. Now only the specific site cache will be cleared. This was already the current behavior on a multisite network with the subdomain configuration.
Update type validations to use
is_int()
andis_string()
to improve code readability (e.g. instead of! $var = (string) $var
).Update
Cache_Enabler_Disk::_file_path()
to useget_site_url()
. This is required to properly clear the cache by URL when installed on a network installation. Previously when network activated and a new site was created the hostname of the network admin was used instead of the current blog.Add
CE_SETTINGS_PATH
constant for advanced cache settings file path.Add
Cache_Enabler::clear_blog_id_cache()
to clear the complete cache of a blog in a network installation by the blog ID (for both subdomain and subdirectory configurations).Add
Cache_Enabler::get_blog_domain()
so bothCache_Enabler_Disk::_get_settings()
andCache_Enabler::clear_blog_id_cache()
use the same method to get the blog domain.