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(); }
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(); }