Add Cache_Enabler_Disk::get_site_objects() to get the file system objects of a specific site. In most cases getting the site objects is as simple as getting the directory objects in the site directory, however, it needs to be filtered if the main site in a subdirectory network. This is because all other sites objects are stored in the main site directory too. This will fix the edge case of clearing the complete network cache when clearing the main site in a subdirectory network installed in a subdirectory. This will also fix getting the cache size for the main site in a subdirectory network (completing what was mentioned in PR #147).
Update Cache_Enabler::clear_site_cache_by_blog_id() to work for both single and multisites to allow the site cache of a single site to be cleared with this method. This can be done by using 1, which is returned when using get_current_blog_id() in a single site installation. Use Cache_Enabler_Disk::get_site_objects() to get the page(s) that need to be cleared. When deleting the cache size transient in a multisite installation switch to the blog ID provided to always ensure the correct transient is deleted. This fixes the case where the cache size transient of the main site would always be deleted when clearing the site cache through WP-CLI, regardless of the site(s) cleared.
Update Cache_Enabler::clear_complete_cache() to delete all cache size transients instead of only the main site. This fixes the issue where the cache size transient was not being deleted for all other sites when clearing the network cache.
Update Cache_Enabler::get_cache_size_transient_name() to not include the blog ID in the name as this is actually not required as the transient will be stored in the applicable site options table. Removing it prevents having to update methods to allow the blog ID to be included when this is called in Cache_Enabler::clear_complete_cache().
Update Cache_Enabler_Disk::clear_cache() to check if the directory exists before trying to clear it.
Update returned success message for multisites when clearing the complete cache with WP-CLI. Show the network has been cleared regardless if network activated because the entire network is actually cleared either way.
Remove the is_file() check from Cache_Enabler_Disk::cache_file_dir_path() because with the updates made to Cache_Enabler::clear_site_cache_by_blog_id() it will be triggered in nearly all cases when the site cache is cleared. I have been unable to identify what the purpose of this was for because the cache will not be delivered if the file is not readable (if two files were concatenated when getting the cache that file would not exist or be readable).
Add
Cache_Enabler_Disk::get_site_objects()
to get the file system objects of a specific site. In most cases getting the site objects is as simple as getting the directory objects in the site directory, however, it needs to be filtered if the main site in a subdirectory network. This is because all other sites objects are stored in the main site directory too. This will fix the edge case of clearing the complete network cache when clearing the main site in a subdirectory network installed in a subdirectory. This will also fix getting the cache size for the main site in a subdirectory network (completing what was mentioned in PR #147).Update
Cache_Enabler::clear_site_cache_by_blog_id()
to work for both single and multisites to allow the site cache of a single site to be cleared with this method. This can be done by using1
, which is returned when usingget_current_blog_id()
in a single site installation. UseCache_Enabler_Disk::get_site_objects()
to get the page(s) that need to be cleared. When deleting the cache size transient in a multisite installation switch to the blog ID provided to always ensure the correct transient is deleted. This fixes the case where the cache size transient of the main site would always be deleted when clearing the site cache through WP-CLI, regardless of the site(s) cleared.Update
Cache_Enabler::clear_complete_cache()
to delete all cache size transients instead of only the main site. This fixes the issue where the cache size transient was not being deleted for all other sites when clearing the network cache.Update
Cache_Enabler::get_cache_size_transient_name()
to not include the blog ID in the name as this is actually not required as the transient will be stored in the applicable site options table. Removing it prevents having to update methods to allow the blog ID to be included when this is called inCache_Enabler::clear_complete_cache()
.Update
Cache_Enabler_Disk::clear_cache()
to check if the directory exists before trying to clear it.Update returned success message for multisites when clearing the complete cache with WP-CLI. Show the network has been cleared regardless if network activated because the entire network is actually cleared either way.
Remove the
is_file()
check fromCache_Enabler_Disk::cache_file_dir_path()
because with the updates made toCache_Enabler::clear_site_cache_by_blog_id()
it will be triggered in nearly all cases when the site cache is cleared. I have been unable to identify what the purpose of this was for because the cache will not be delivered if the file is not readable (if two files were concatenated when getting the cache that file would not exist or be readable).