• Resolved kettari

    (@kettari)


    Hi,

    I think I found two typos within functions wp_cache_clean_cache() and wp_cache_clean_expired() (see file wp-cache.php). WP-Super-Cache version 0.8.6.

    Function wp_cache_clean_cache(), lines 1156 to 1183:

    function wp_cache_clean_cache($file_prefix) {
    	global $cache_path, $supercachedir;
    
    	// If phase2 was compiled, use its function to avoid race-conditions
    	if(function_exists('wp_cache_phase2_clean_cache')) {
    		if (function_exists ('prune_super_cache')) {
    			if( is_dir( $supercachedir ) ) {
    				prune_super_cache( $supercachedir, true );
    			} elseif( is_dir( $supercachedir . '.disabled' ) ) {
    				prune_super_cache( $supercachedir . '.disabled', true );
    			}
    			prune_super_cache( $cache_path, true );
    			$_POST[ 'super_cache_stats' ] = 1; // regenerate super cache stats;
    		}
    		return wp_cache_phase2_clean_cache($file_prefix);
    	}
    
    	$expr = "/^$file_prefix/";
    	if ( ($handle = opendir( $cache_path )) ) {
    		while ( false !== ($file = readdir($handle))) {
    			if ( preg_match($expr, $file) ) {
    				@unlink($cache_path . $file);
    				@unlink($cache_path . 'meta/' . str_replace( '.html', '.term', $file ) );
    			}
    		}
    		closedir($handle);
    	}
    }

    Look at the line starting with “@unlink($cache_path . ‘meta/'” near the end. See that substring ‘.term’? As far as I can see, plugin creates meta files with extension ‘.meta’, not ‘.term’. So these functions actually leave meta files untouched when cache cleaning functions are called.

    If it is true, then one should replace the ‘.term’ with ‘.meta’ on the lines #1180 and #1211.

    Looking forward for your comments.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thanks for that. I’ve just fixed it in trunk, but it’s not a showstopper as the meta files are deleted when they’re recreated.

    The code that serves cached files checks for the cache file and meta file so there’s no chance a non existent cache file could be served.

    Thread Starter kettari

    (@kettari)

    OK with that. Thank you for fast reply, donncha!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: WP Super Cache] Typos in the wp_cache_clean_cache() and more (v 0.8.6)’ is closed to new replies.