/** Diable here because PHP4.3 does not make the global
 Serious bug?

$mutex_filename = 'wp_cache_mutex.lock';
$new_cache = false;
*/
function wp_cache_phase2()
{
    global $cache_filename, $cache_acceptable_files;
    wp_cache_mutex_init();
    if (function_exists('add_action')) {
        // Post ID is received
        add_action('publish_post', 'wp_cache_post_change', 0);
        add_action('edit_post', 'wp_cache_post_change', 0);
        add_action('delete_post', 'wp_cache_post_change', 0);
        add_action('publish_phone', 'wp_cache_post_change', 0);
        // Coment ID is received
        add_action('trackback_post', 'wp_cache_get_postid_from_comment', 0);
        add_action('pingback_post', 'wp_cache_get_postid_from_comment', 0);
        add_action('comment_post', 'wp_cache_get_postid_from_comment', 0);
        add_action('edit_comment', 'wp_cache_get_postid_from_comment', 0);
        add_action('wp_set_comment_status', 'wp_cache_get_postid_from_comment', 0);
        // No post_id is available
        add_action('delete_comment', 'wp_cache_no_postid', 0);
        add_action('switch_theme', 'wp_cache_no_postid', 0);
    }
    //$script = basename($_SERVER['SCRIPT_NAME']);
    if ($_SERVER["REQUEST_METHOD"] == 'POST' || get_settings('gzipcompression')) {
        return;
    }
    $script = basename($_SERVER['PHP_SELF']);
    if (!in_array($script, $cache_acceptable_files) && wp_cache_is_rejected($_SERVER["REQUEST_URI"])) {
        return;
    }
    if (wp_cache_user_agent_is_rejected()) {
        return;
    }
    ob_start('wp_cache_ob_callback');
    register_shutdown_function('wp_cache_ob_end');
}
/** Diable here because PHP4.3 does not make the global
 Serious bug?

$mutex_filename = 'wp_cache_mutex.lock';
$new_cache = false;
*/
function wp_cache_phase2()
{
    global $cache_filename, $cache_acceptable_files, $wp_cache_meta_object;
    wp_cache_mutex_init();
    if (function_exists('add_action')) {
        // Post ID is received
        add_action('publish_post', 'wp_cache_post_change', 0);
        add_action('edit_post', 'wp_cache_post_change', 0);
        add_action('delete_post', 'wp_cache_post_change', 0);
        add_action('publish_phone', 'wp_cache_post_change', 0);
        // Coment ID is received
        add_action('trackback_post', 'wp_cache_get_postid_from_comment', 0);
        add_action('pingback_post', 'wp_cache_get_postid_from_comment', 0);
        add_action('comment_post', 'wp_cache_get_postid_from_comment', 0);
        add_action('edit_comment', 'wp_cache_get_postid_from_comment', 0);
        add_action('wp_set_comment_status', 'wp_cache_get_postid_from_comment', 0);
        // No post_id is available
        add_action('delete_comment', 'wp_cache_no_postid', 0);
        add_action('switch_theme', 'wp_cache_no_postid', 0);
    }
    //$script = basename($_SERVER['SCRIPT_NAME']);
    if ($_SERVER["REQUEST_METHOD"] == 'POST' || get_settings('gzipcompression')) {
        return;
    }
    $script = basename($_SERVER['PHP_SELF']);
    if (!in_array($script, $cache_acceptable_files) && wp_cache_is_rejected($_SERVER["REQUEST_URI"])) {
        return;
    }
    if (wp_cache_user_agent_is_rejected()) {
        return;
    }
    if (is_user_logged_in()) {
        return;
    }
    // don't cache pages of logged in users, that is lame.
    foreach ($_COOKIE as $key => $val) {
        if (strstr($key, 'comment_author')) {
            return;
            // don't perform caching of pages that commenters see, that is lame
        }
    }
    $wp_cache_meta_object = new CacheMeta();
    ob_start('wp_cache_ob_callback');
    register_shutdown_function('wp_cache_shutdown_callback');
}
示例#3
0
function wp_cache_phase2()
{
    global $cache_filename, $cache_acceptable_files, $wp_cache_gzip_encoding, $super_cache_enabled, $cache_rebuild_files, $wp_cache_gmt_offset, $wp_cache_blog_charset, $wp_cache_last_gc;
    global $cache_max_time, $wp_cache_not_logged_in, $wp_cache_request_uri, $super_cache_enabled;
    if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
        wp_cache_debug('In WP Cache Phase 2', 5);
    }
    $wp_cache_gmt_offset = get_option('gmt_offset');
    // caching for later use when wpdb is gone. http://wordpress.org/support/topic/224349
    $wp_cache_blog_charset = get_option('blog_charset');
    wp_cache_mutex_init();
    if (function_exists('add_action') && (!defined('WPLOCKDOWN') || defined('WPLOCKDOWN') && constant('WPLOCKDOWN') == '0')) {
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug('Setting up WordPress actions', 5);
        }
        // Post ID is received
        add_action('publish_post', 'wp_cache_post_edit', 0);
        add_action('edit_post', 'wp_cache_post_change', 0);
        // leaving a comment called edit_post
        add_action('delete_post', 'wp_cache_post_edit', 0);
        add_action('publish_phone', 'wp_cache_post_edit', 0);
        // Coment ID is received
        add_action('trackback_post', 'wp_cache_get_postid_from_comment', 99);
        add_action('pingback_post', 'wp_cache_get_postid_from_comment', 99);
        add_action('comment_post', 'wp_cache_get_postid_from_comment', 99);
        add_action('edit_comment', 'wp_cache_get_postid_from_comment', 99);
        add_action('wp_set_comment_status', 'wp_cache_get_postid_from_comment', 99, 2);
        // No post_id is available
        add_action('switch_theme', 'wp_cache_no_postid', 99);
        add_action('edit_user_profile_update', 'wp_cache_no_postid', 99);
        add_action('wp_cache_gc', 'wp_cache_gc_cron');
        do_cacheaction('add_cacheaction');
    }
    if (is_admin()) {
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug('Not caching wp-admin requests.', 5);
        }
        return false;
    }
    if ($_SERVER["REQUEST_METHOD"] == 'POST' || !empty($_POST) || get_option('gzipcompression')) {
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug('Not caching POST request.', 5);
        }
        return false;
    }
    if (isset($_GET['preview'])) {
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug('Not caching preview post.', 2);
        }
        return false;
    }
    if (!empty($_GET)) {
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug('Supercache caching disabled. Non empty GET request.', 5);
        }
        $super_cache_enabled = false;
    }
    if ($wp_cache_not_logged_in && is_user_logged_in() && !is_feed() && !is_admin()) {
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug('not caching for logged in user', 5);
            register_shutdown_function('wpcache_logged_in_message');
        }
        return false;
    }
    $script = basename($_SERVER['PHP_SELF']);
    if (!in_array($script, $cache_acceptable_files) && wp_cache_is_rejected($wp_cache_request_uri)) {
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug('URI rejected. Not Caching', 2);
        }
        return false;
    }
    if (wp_cache_user_agent_is_rejected()) {
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug("USER AGENT ({$_SERVER['HTTP_USER_AGENT']}) rejected. Not Caching", 4);
        }
        return;
    }
    if ($wp_cache_gzip_encoding) {
        header('Vary: Accept-Encoding, Cookie');
    } else {
        header('Vary: Cookie');
    }
    ob_start('wp_cache_ob_callback');
    if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
        wp_cache_debug('Created output buffer', 4);
    }
    // restore old supercache file temporarily
    if ($super_cache_enabled && $cache_rebuild_files) {
        $user_info = wp_cache_get_cookies_values();
        $do_cache = apply_filters('do_createsupercache', $user_info);
        if ($user_info == '' || $do_cache === true) {
            $dir = get_current_url_supercache_dir();
            $files_to_check = array($dir . 'index.html', $dir . 'index.html.gz');
            foreach ($files_to_check as $cache_file) {
                if (!@file_exists($cache_file . '.needs-rebuild')) {
                    continue;
                }
                $mtime = @filemtime($cache_file . '.needs-rebuild');
                if ($mtime && time() - $mtime < 30) {
                    if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
                        wp_cache_debug("Rebuild file renamed to cache file temporarily", 3);
                    }
                    @rename($cache_file . '.needs-rebuild', $cache_file);
                }
                // cleanup old files or if rename fails
                if (@file_exists($cache_file . '.needs-rebuild')) {
                    if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
                        wp_cache_debug("Rebuild file deleted", 3);
                    }
                    @unlink($cache_file . '.needs-rebuild');
                }
            }
        }
    }
    if (!isset($cache_max_time)) {
        $cache_max_time = 600;
    }
    $last_gc = get_option("wpsupercache_gc_time");
    if (!$last_gc) {
        update_option('wpsupercache_gc_time', time());
    }
    $next_gc = $cache_max_time < 1800 ? $cache_max_time : 600;
    if ($last_gc < time() - $next_gc) {
        update_option('wpsupercache_gc_time', time());
        global $wp_cache_shutdown_gc;
        if (!isset($wp_cache_shutdown_gc) || $wp_cache_shutdown_gc == 0) {
            if (!wp_next_scheduled('wp_cache_gc')) {
                wp_schedule_single_event(time() + 10, 'wp_cache_gc');
                if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
                    wp_cache_debug('scheduled wp_cache_gc for 10 seconds time.', 5);
                }
            }
        } else {
            global $time_to_gc_cache;
            $time_to_gc_cache = 1;
            // tell the "shutdown gc" to run!
        }
    }
}
function wp_cache_phase2()
{
    global $cache_filename, $cache_acceptable_files, $wp_cache_gzip_encoding, $super_cache_enabled, $cache_rebuild_files, $wp_cache_gmt_offset, $wp_cache_blog_charset, $wp_cache_last_gc;
    global $cache_max_time;
    $wp_cache_gmt_offset = get_option('gmt_offset');
    // caching for later use when wpdb is gone. http://wordpress.org/support/topic/224349
    $wp_cache_blog_charset = get_option('blog_charset');
    wp_cache_mutex_init();
    if (function_exists('add_action') && (!defined('WPLOCKDOWN') || defined('WPLOCKDOWN') && constant('WPLOCKDOWN') == '0')) {
        // Post ID is received
        add_action('publish_post', 'wp_cache_post_edit', 0);
        add_action('edit_post', 'wp_cache_post_change', 0);
        // leaving a comment called edit_post
        add_action('delete_post', 'wp_cache_post_edit', 0);
        add_action('publish_phone', 'wp_cache_post_edit', 0);
        // Coment ID is received
        add_action('trackback_post', 'wp_cache_get_postid_from_comment', 99);
        add_action('pingback_post', 'wp_cache_get_postid_from_comment', 99);
        add_action('comment_post', 'wp_cache_get_postid_from_comment', 99);
        add_action('edit_comment', 'wp_cache_get_postid_from_comment', 99);
        add_action('wp_set_comment_status', 'wp_cache_get_postid_from_comment', 99);
        // No post_id is available
        add_action('delete_comment', 'wp_cache_no_postid', 99);
        add_action('switch_theme', 'wp_cache_no_postid', 99);
        add_action('wp_cache_gc', 'wp_cache_gc_cron');
        do_cacheaction('add_cacheaction');
    }
    if ($_SERVER["REQUEST_METHOD"] == 'POST' || get_option('gzipcompression')) {
        return;
    }
    $script = basename($_SERVER['PHP_SELF']);
    if (!in_array($script, $cache_acceptable_files) && wp_cache_is_rejected($_SERVER["REQUEST_URI"])) {
        return;
    }
    if (wp_cache_user_agent_is_rejected()) {
        return;
    }
    if ($wp_cache_gzip_encoding) {
        header('Vary: Accept-Encoding, Cookie');
    } else {
        header('Vary: Cookie');
    }
    ob_start('wp_cache_ob_callback');
    // restore old supercache file temporarily
    if ($super_cache_enabled && $cache_rebuild_files) {
        $user_info = wp_cache_get_cookies_values();
        $do_cache = apply_filters('do_createsupercache', $user_info);
        if ($user_info == '' || $do_cache === true) {
            $dir = get_current_url_supercache_dir();
            $files_to_check = array($dir . 'index.html', $dir . 'index.html.gz');
            foreach ($files_to_check as $cache_file) {
                if (!@file_exists($cache_file . '.needs-rebuild')) {
                    continue;
                }
                $mtime = @filemtime($cache_file . '.needs-rebuild');
                if ($mtime && time() - $mtime < 30) {
                    @rename($cache_file . '.needs-rebuild', $cache_file);
                }
                // cleanup old files or if rename fails
                if (@file_exists($cache_file . '.needs-rebuild')) {
                    @unlink($cache_file . '.needs-rebuild');
                }
            }
        }
    }
    if (!isset($cache_max_time)) {
        $cache_max_time = 600;
    }
    $last_gc = get_option("wpsupercache_gc_time");
    if (!$last_gc) {
        update_option('wpsupercache_gc_time', time());
    }
    $next_gc = $cache_max_time < 1800 ? $cache_max_time : 600;
    if ($last_gc < time() - $next_gc) {
        update_option('wpsupercache_gc_time', time());
        global $wp_cache_shutdown_gc;
        if (!isset($wp_cache_shutdown_gc) || $wp_cache_shutdown_gc == 0) {
            if (!wp_next_scheduled('wp_cache_gc')) {
                wp_schedule_single_event(time() + 10, 'wp_cache_gc');
            }
        } else {
            global $time_to_gc_cache;
            $time_to_gc_cache = 1;
            // tell the "shutdown gc" to run!
        }
    }
}
function wp_cache_phase2()
{
    global $wpsc_settings;
    global $cache_filename, $cache_acceptable_files, $wp_cache_gzip_encoding, $super_cache_enabled, $cache_rebuild_files, $wp_cache_last_gc;
    global $cache_max_time, $wp_cache_request_uri, $super_cache_enabled, $wp_cache_object_cache, $cache_time_interval;
    global $cache_enabled, $wp_cache_gmt_offset, $wp_cache_blog_charset, $cache_schedule_type, $cache_scheduled_time, $cache_schedule_interval;
    if ($cache_enabled == false) {
        return false;
    }
    if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
        wp_cache_debug('In WP Cache Phase 2', 5);
    }
    $wp_cache_gmt_offset = get_option('gmt_offset');
    // caching for later use when wpdb is gone. http://wordpress.org/support/topic/224349
    $wp_cache_blog_charset = get_option('blog_charset');
    wp_cache_mutex_init();
    if (function_exists('add_action') && (!defined('WPLOCKDOWN') || defined('WPLOCKDOWN') && constant('WPLOCKDOWN') == '0')) {
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug('Setting up WordPress actions', 5);
        }
        // Post ID is received
        add_action('publish_post', 'wp_cache_post_edit', 0);
        add_action('edit_post', 'wp_cache_post_change', 0);
        // leaving a comment called edit_post
        add_action('delete_post', 'wp_cache_post_edit', 0);
        add_action('publish_phone', 'wp_cache_post_edit', 0);
        // Coment ID is received
        add_action('trackback_post', 'wp_cache_get_postid_from_comment', 99);
        add_action('pingback_post', 'wp_cache_get_postid_from_comment', 99);
        add_action('comment_post', 'wp_cache_get_postid_from_comment', 99);
        add_action('edit_comment', 'wp_cache_get_postid_from_comment', 99);
        add_action('wp_set_comment_status', 'wp_cache_get_postid_from_comment', 99, 2);
        // No post_id is available
        add_action('switch_theme', 'wp_cache_no_postid', 99);
        add_action('edit_user_profile_update', 'wp_cache_no_postid', 99);
        add_action('wp_update_nav_menu', 'wp_cache_clear_cache');
        add_action('wp_cache_gc', 'wp_cache_gc_cron');
        add_filter('supercache_filename_str', 'wp_cache_check_mobile');
        do_cacheaction('add_cacheaction');
    }
    if (is_admin()) {
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug('Not caching wp-admin requests.', 5);
        }
        return false;
    }
    if ($_SERVER["REQUEST_METHOD"] == 'POST' || !empty($_POST) || get_option('gzipcompression')) {
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug('Not caching POST request.', 5);
        }
        return false;
    }
    if ($wp_cache_object_cache && !empty($_GET)) {
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug('Not caching GET request while object cache storage enabled.', 5);
        }
        return false;
    }
    if (isset($_GET['preview'])) {
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug('Not caching preview post.', 2);
        }
        return false;
    }
    if (!empty($_GET)) {
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug('Supercache caching disabled. Only using wp-cache. Non empty GET request.', 5);
        }
        $super_cache_enabled = false;
    }
    $script = basename($_SERVER['PHP_SELF']);
    if (!in_array($script, $cache_acceptable_files) && wp_cache_is_rejected($wp_cache_request_uri)) {
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug('URI rejected. Not Caching', 2);
        }
        return false;
    }
    if (wp_cache_user_agent_is_rejected()) {
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug("USER AGENT ({$_SERVER['HTTP_USER_AGENT']}) rejected. Not Caching", 4);
        }
        return;
    }
    if ($wp_cache_gzip_encoding) {
        header('Vary: Accept-Encoding, Cookie');
    } else {
        header('Vary: Cookie');
    }
    ob_start('wp_cache_ob_callback');
    if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
        wp_cache_debug('Created output buffer', 4);
    }
    // restore old supercache file temporarily
    if ($super_cache_enabled && $cache_rebuild_files) {
        $user_info = wp_cache_get_cookies_values();
        $do_cache = apply_filters('do_createsupercache', $user_info);
        if ($user_info == '' || $do_cache === true) {
            wpcache_do_rebuild(get_current_url_supercache_dir());
        }
    }
    schedule_wp_gc();
}
示例#6
0
function wp_cache_phase2()
{
    global $cache_filename, $cache_acceptable_files, $wp_cache_gzip_encoding, $super_cache_enabled, $cache_rebuild_files, $wp_cache_last_gc;
    global $cache_max_time, $wp_cache_request_uri, $super_cache_enabled, $wp_cache_object_cache, $cache_time_interval;
    global $cache_enabled, $wp_cache_gmt_offset, $wp_cache_blog_charset, $cache_schedule_type, $cache_scheduled_time, $cache_schedule_interval;
    if ($cache_enabled == false) {
        wp_cache_debug("Caching disabled! quiting!", 1);
        return false;
    }
    wp_cache_debug('In WP Cache Phase 2', 5);
    $wp_cache_gmt_offset = get_option('gmt_offset');
    // caching for later use when wpdb is gone. http://wordpress.org/support/topic/224349
    $wp_cache_blog_charset = get_option('blog_charset');
    wp_cache_mutex_init();
    if (function_exists('add_action') && (!defined('WPLOCKDOWN') || defined('WPLOCKDOWN') && constant('WPLOCKDOWN') == '0')) {
        wp_cache_debug('Setting up WordPress actions', 5);
        add_action('template_redirect', 'wp_super_cache_query_vars');
        // Post ID is received
        add_action('wp_trash_post', 'wp_cache_post_edit', 0);
        add_action('publish_post', 'wp_cache_post_edit', 0);
        add_action('edit_post', 'wp_cache_post_change', 0);
        // leaving a comment called edit_post
        add_action('delete_post', 'wp_cache_post_edit', 0);
        add_action('publish_phone', 'wp_cache_post_edit', 0);
        // Coment ID is received
        add_action('trackback_post', 'wp_cache_get_postid_from_comment', 99);
        add_action('pingback_post', 'wp_cache_get_postid_from_comment', 99);
        add_action('comment_post', 'wp_cache_get_postid_from_comment', 99);
        add_action('edit_comment', 'wp_cache_get_postid_from_comment', 99);
        add_action('wp_set_comment_status', 'wp_cache_get_postid_from_comment', 99, 2);
        // No post_id is available
        add_action('switch_theme', 'wp_cache_no_postid', 99);
        add_action('edit_user_profile_update', 'wp_cache_no_postid', 99);
        add_action('wp_update_nav_menu', 'wp_cache_clear_cache_on_menu');
        add_action('wp_cache_gc', 'wp_cache_gc_cron');
        add_action('clean_post_cache', 'wp_cache_post_edit');
        add_filter('supercache_filename_str', 'wp_cache_check_mobile');
        add_action('wp_cache_gc_watcher', 'wp_cache_gc_watcher');
        add_action('transition_post_status', 'wpsc_post_transition', 10, 3);
        do_cacheaction('add_cacheaction');
    }
    if (is_admin()) {
        wp_cache_debug('Not caching wp-admin requests.', 5);
        return false;
    }
    if (!empty($_GET)) {
        wp_cache_debug('Supercache caching disabled. Only using wp-cache. Non empty GET request. ' . serialize($_GET), 5);
        $super_cache_enabled = false;
    }
    if ($wp_cache_gzip_encoding) {
        header('Vary: Accept-Encoding, Cookie');
    } else {
        header('Vary: Cookie');
    }
    ob_start('wp_cache_ob_callback');
    wp_cache_debug('Created output buffer', 4);
    // restore old supercache file temporarily
    if ($super_cache_enabled && $cache_rebuild_files) {
        $user_info = wp_cache_get_cookies_values();
        $do_cache = apply_filters('do_createsupercache', $user_info);
        if ($user_info == '' || $do_cache === true) {
            wpcache_do_rebuild(get_current_url_supercache_dir());
        }
    }
    schedule_wp_gc();
}
示例#7
0
function wp_cache_phase2()
{
    global $cache_filename, $cache_acceptable_files, $wp_cache_meta_object, $wp_cache_gzip_encoding, $super_cache_enabled, $cache_rebuild_files;
    wp_cache_mutex_init();
    if (function_exists('add_action') && (!defined('WPLOCKDOWN') || defined('WPLOCKDOWN') && constant('WPLOCKDOWN') == '0')) {
        // Post ID is received
        add_action('publish_post', 'wp_cache_post_edit', 0);
        add_action('edit_post', 'wp_cache_post_change', 0);
        // leaving a comment called edit_post
        add_action('delete_post', 'wp_cache_post_edit', 0);
        add_action('publish_phone', 'wp_cache_post_edit', 0);
        // Coment ID is received
        add_action('trackback_post', 'wp_cache_get_postid_from_comment', 0);
        add_action('pingback_post', 'wp_cache_get_postid_from_comment', 0);
        add_action('comment_post', 'wp_cache_get_postid_from_comment', 0);
        add_action('edit_comment', 'wp_cache_get_postid_from_comment', 0);
        add_action('wp_set_comment_status', 'wp_cache_get_postid_from_comment', 0);
        // No post_id is available
        add_action('delete_comment', 'wp_cache_no_postid', 0);
        add_action('switch_theme', 'wp_cache_no_postid', 0);
        add_action('wp_cache_gc', 'wp_cache_gc_cron');
        do_cacheaction('add_cacheaction');
    }
    if ($_SERVER["REQUEST_METHOD"] == 'POST' || get_option('gzipcompression')) {
        return;
    }
    $script = basename($_SERVER['PHP_SELF']);
    if (!in_array($script, $cache_acceptable_files) && wp_cache_is_rejected($_SERVER["REQUEST_URI"])) {
        return;
    }
    if (wp_cache_user_agent_is_rejected()) {
        return;
    }
    if (!is_object($wp_cache_meta_object)) {
        $wp_cache_meta_object = new CacheMeta();
    }
    if ($wp_cache_gzip_encoding) {
        header('Vary: Accept-Encoding, Cookie');
    } else {
        header('Vary: Cookie');
    }
    ob_start('wp_cache_ob_callback');
    // restore old supercache file temporarily
    if ($super_cache_enabled && $cache_rebuild_files) {
        $user_info = wp_cache_get_cookies_values();
        $do_cache = apply_filters('do_createsupercache', $user_info);
        if ($user_info == '' || $do_cache === true) {
            $dir = get_current_url_supercache_dir();
            $files_to_check = array($dir . 'index.html', $dir . 'index.html.gz');
            foreach ($files_to_check as $cache_file) {
                if (!file_exists($cache_file . '.needs-rebuild')) {
                    continue;
                }
                $mtime = @filemtime($cache_file . '.needs-rebuild');
                if ($mtime && time() - $mtime < 30) {
                    @rename($cache_file . '.needs-rebuild', $cache_file);
                }
                // cleanup old files or if rename fails
                if (@file_exists($cache_file . '.needs-rebuild')) {
                    @unlink($cache_file . '.needs-rebuild');
                }
            }
        }
    }
    register_shutdown_function('wp_cache_shutdown_callback');
}