Exemple #1
0
function wp_cache_clean_cache($file_prefix)
{
    global $cache_path, $supercachedir, $blog_cache_dir;
    // 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;
        } elseif (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug('Warning! prune_super_cache() not found in wp-cache.php', 1);
        }
        return wp_cache_phase2_clean_cache($file_prefix);
    } elseif (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
        wp_cache_debug('Warning! wp_cache_phase2_clean_cache() not found in wp-cache.php', 1);
    }
    $expr = "/^{$file_prefix}/";
    if ($handle = @opendir($blog_cache_dir)) {
        while (false !== ($file = readdir($handle))) {
            if (preg_match($expr, $file)) {
                @unlink($blog_cache_dir . $file);
                @unlink($blog_cache_dir . 'meta/' . str_replace('.html', '.meta', $file));
            }
        }
        closedir($handle);
    }
}
Exemple #2
0
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);
    }
}
function wp_cache_clean_cache($file_prefix)
{
    global $cache_path;
    // If phase2 was compiled, use its function to avoid race-conditions
    if (function_exists('wp_cache_phase2_clean_cache')) {
        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);
            }
        }
        closedir($handle);
    }
}