Cache Deletion and Code Fix
-
Thank you for adding automatic cache purge with plugin upgrades in version 1.9.12. This is a much-needed and appreciated feature.
However, I have unfortunately discovered that your code is incomplete for the wp_fastest_cache plugin, because that software stores cached html files separately from minified css & javascript separately. The main cache is in an “all” subfolder, whereas the minified script is in a “wpfc-minified” folder. Right now, when wp-spamshield is upgraded, the “all” folder is cleared, but not “wpfc-minified”, resulting in error messages when users later try to post comments from cached pages.
Fortunately, there is an easy fix for this. All you have to do is change the function for wp_fastest_cache from “deleteCache()” to “deleteCache(true)”
Here is the code issue in detail:
1) Relevant, currently existing code in wp_spamshield.php
/* WP Fastest Cache */ if( ( WPSS_Compatibility::is_plugin_active( 'wp-fastest-cache/wpFastestCache.php' ) || WPSS_Compatibility::is_plugin_active( 'wp-fastest-cache-premium/wpFastestCachePremium.php' ) ) && !empty( $wp_fastest_cache ) && method_exists( $wp_fastest_cache, 'deleteCache' ) ) { $wp_fastest_cache->deleteCache(); }2) Function hook to fully clear WP Fastest Cache:
if(isset($GLOBALS['wp_fastest_cache']) && method_exists($GLOBALS['wp_fastest_cache'], 'deleteCache')){ $GLOBALS['wp_fastest_cache']->deleteCache(true); }See http://www.wpfastestcache.com/tutorial/delete-the-cache-by-calling-the-function/
“You can delete the cache and minified css&js sources. You need to add “true” argument into deleteCache(true)”
(Note: this is not a support request, as I already know the answer to my question, which was kindly provided to me by the cache developer. I have tested this by modifying the plugin file on one of my sites, and it works. The relevant code change is at line 9188)
The topic ‘Cache Deletion and Code Fix’ is closed to new replies.