Esempio n. 1
0
 private function clear_cache_wpsupercache()
 {
     $all = true;
     global $updraftplus, $cache_path, $wp_cache_object_cache;
     if ($wp_cache_object_cache && function_exists("reset_oc_version")) {
         reset_oc_version();
     }
     // Removed check: && wpsupercache_site_admin()
     if ($all == true && function_exists('prune_super_cache')) {
         if (!empty($cache_path)) {
             $updraftplus->log_e("Clearing cached pages (%s)...", 'WP Super Cache');
             prune_super_cache($cache_path, true);
         }
         return true;
     }
 }
Esempio n. 2
0
function wp_cache_clean_cache($file_prefix, $all = false)
{
    global $wpdb, $cache_path, $supercachedir, $blog_cache_dir, $wp_cache_object_cache;
    if ($wp_cache_object_cache && function_exists("reset_oc_version")) {
        reset_oc_version();
    }
    if ($all == true && wpsupercache_site_admin() && function_exists('prune_super_cache')) {
        prune_super_cache($cache_path, true);
        return true;
    }
    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);
        }
        $_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);
    }
    if ($handle = @opendir($blog_cache_dir . 'meta/')) {
        while (false !== ($file = readdir($handle))) {
            if (preg_match("/^{$file_prefix}/", $file)) {
                $meta = unserialize(file_get_contents($blog_cache_dir . 'meta/' . $file));
                if ($meta['blog_id'] == $wpdb->blogid) {
                    @unlink($blog_cache_dir . 'meta/' . $file);
                    @unlink($blog_cache_dir . str_replace('.meta', '.html', $file));
                }
            }
        }
        closedir($handle);
    }
}
Esempio n. 3
0
 public function clearCache()
 {
     if (SAM_WPSC) {
         global $blog_cache_dir, $wp_cache_object_cache;
         if ($wp_cache_object_cache) {
             reset_oc_version();
         } else {
             prune_super_cache($blog_cache_dir, true);
             prune_super_cache(get_supercache_dir(), true);
         }
         return __('Cache of WP Super Cache plugin is flushed.', SAM_DOMAIN);
     } elseif (SAM_W3TC) {
         if (function_exists('w3tc_pgcache_flush')) {
             w3tc_pgcache_flush();
         }
         if (function_exists('w3tc_dbcache_flush')) {
             w3tc_dbcache_flush();
         }
         return __('Cache of W3 Total Cache plugin is flushed.', SAM_DOMAIN);
     } else {
         return '';
     }
 }
Esempio n. 4
0
function wp_cache_clean_cache($file_prefix)
{
    global $cache_path, $supercachedir, $blog_cache_dir, $wp_cache_object_cache;
    if ($wp_cache_object_cache && function_exists("reset_oc_version")) {
        reset_oc_version();
    }
    // 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);
    }
}
function get_oc_version()
{
    $wp_cache_oc_key = wp_cache_get("wp_cache_oc_key");
    if (!$wp_cache_oc_key) {
        $wp_cache_oc_key['key'] = reset_oc_version();
    } elseif ($wp_cache_oc_key['ts'] < time() - 600) {
        wp_cache_set("wp_cache_oc_key", array('ts' => time(), 'key' => $wp_cache_oc_key['key']));
    }
    return $wp_cache_oc_key['key'];
}
function wp_cache_clean_cache($file_prefix, $all = false)
{
    global $wpdb, $cache_path, $supercachedir, $blog_cache_dir, $wp_cache_object_cache;
    if ($wp_cache_object_cache && function_exists("reset_oc_version")) {
        reset_oc_version();
    }
    if ($all == true && wpsupercache_site_admin() && function_exists('prune_super_cache')) {
        prune_super_cache($cache_path, true);
        return true;
    }
    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);
        }
        $_POST['super_cache_stats'] = 1;
        // regenerate super cache stats;
    } else {
        wp_cache_debug('Warning! prune_super_cache() not found in wp-cache.php', 1);
    }
    wp_cache_clean_legacy_files($blog_cache_dir, $file_prefix);
    wp_cache_clean_legacy_files($cache_path, $file_prefix);
}
function wp_cache_post_change($post_id)
{
    global $file_prefix, $cache_path, $blog_id, $super_cache_enabled, $blog_cache_dir, $blogcacheid, $wp_cache_refresh_single_only;
    static $last_processed = -1;
    if ($post_id == $last_processed) {
        return $post_id;
    }
    $last_processed = $post_id;
    $post = get_post($post_id);
    if ($post->post_status == 'draft') {
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug("wp_cache_post_change: draft post, not deleting any cache files.", 4);
        }
        return $post_id;
    }
    if (!wp_cache_writers_entry()) {
        return $post_id;
    }
    if (isset($wp_cache_refresh_single_only) && $wp_cache_refresh_single_only && strpos($_SERVER['REQUEST_URI'], 'wp-comments-post.php')) {
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug("wp_cache_post_change: comment detected. only deleting post page.", 4);
        }
        $all = false;
    } else {
        $all = true;
    }
    if ($wp_cache_object_cache) {
        reset_oc_version();
    }
    $permalink = trailingslashit(str_replace(get_option('siteurl'), '', post_permalink($post_id)));
    if ($super_cache_enabled) {
        $dir = get_supercache_dir();
        $siteurl = trailingslashit(strtolower(preg_replace('/:.*$/', '', str_replace('http://', '', get_option('home')))));
        // make sure the front page has a rebuild file
        wp_cache_post_id_gc($siteurl, $post_id);
        // make sure the front page has a rebuild file
        if ($all == true) {
            if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
                wp_cache_debug("Post change: deleting cache files in " . $cache_path . 'supercache/' . $siteurl, 4);
            }
            $files_to_check = get_all_supercache_filenames($dir);
            foreach ($files_to_check as $cache_file) {
                prune_super_cache($dir . $cache_file, true, true);
            }
            do_action('gc_cache', 'prune', 'homepage');
        }
        wp_cache_post_id_gc($siteurl, $post_id);
        if ($all == true && get_option('show_on_front') == 'page') {
            if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
                wp_cache_debug("Post change: deleting page_on_front and page_for_posts pages.", 4);
            }
            if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
                wp_cache_debug("Post change: page_on_front " . get_option('page_on_front'), 4);
            }
            wp_cache_post_id_gc($siteurl, get_option('page_on_front'), 'single');
            $permalink = trailingslashit(str_replace(get_option('home'), '', post_permalink(get_option('page_for_posts'))));
            $files_to_check = get_all_supercache_filenames($dir . $permalink);
            foreach ($files_to_check as $cache_file) {
                prune_super_cache($dir . $permalink . $cache_file, true, true);
            }
            do_action('gc_cache', 'prune', $permalink);
        }
    }
    $matches = array();
    if ($handle = @opendir($blog_cache_dir . 'meta/')) {
        while (false !== ($file = readdir($handle))) {
            if (preg_match("/^({$file_prefix}{$blogcacheid}.*)\\.meta/", $file, $matches)) {
                $meta_pathname = $blog_cache_dir . 'meta/' . $file;
                $content_pathname = $blog_cache_dir . $matches[1] . ".html";
                $meta = unserialize(@file_get_contents($meta_pathname));
                if (false == is_array($meta)) {
                    if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
                        wp_cache_debug("Post change cleaning up stray file: {$content_pathname}", 4);
                    }
                    @unlink($meta_pathname);
                    @unlink($content_pathname);
                    continue;
                }
                if ($post_id > 0 && $meta) {
                    $permalink = trailingslashit(str_replace(get_option('home'), '', post_permalink($post_id)));
                    if ($meta['blog_id'] == $blog_id && ($all == true && !$meta['post'] || $meta['post'] == $post_id)) {
                        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
                            wp_cache_debug("Post change: deleting post cache files for {$meta['uri']}: {$content_pathname}", 4);
                        }
                        @unlink($meta_pathname);
                        @unlink($content_pathname);
                        if ($super_cache_enabled == true) {
                            @prune_super_cache($dir . $permalink, true, true);
                            do_action('gc_cache', 'rebuild', $permalink);
                        }
                    }
                } elseif ($meta['blog_id'] == $blog_id) {
                    if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
                        wp_cache_debug("Post change: deleting cache files for {$meta['uri']}: {$content_pathname}", 4);
                    }
                    @unlink($meta_pathname);
                    @unlink($content_pathname);
                    if ($super_cache_enabled == true) {
                        $files_to_check = get_all_supercache_filenames($dir . $meta['uri']);
                        foreach ($files_to_check as $cache_file) {
                            @wp_cache_rebuild_or_delete($dir . trailingslashit($meta['uri']) . $cache_file);
                        }
                        do_action('gc_cache', 'rebuild', trailingslashit($meta['uri']));
                    }
                }
            }
        }
        closedir($handle);
    }
    wp_cache_writers_exit();
    return $post_id;
}
function LivelyChatSupport_admin()
{
    global $wpdb;
    wp_register_style("LivelyChatSupport-admin-css", plugins_url("lively-chat-support/admin/css/style.css"));
    wp_register_style("LivelyChatSupport-chatbox-reset", plugins_url("lively-chat-support/chatbox/css/reset.css"));
    wp_register_style("LivelyChatSupport-chatbox-style", plugins_url("lively-chat-support/chatbox/css/style.css"));
    wp_register_style("LivelyChatSupport-jQuery-UI", plugins_url("lively-chat-support/admin/css/livelychatsupport.jquery-ui.min.css"));
    wp_enqueue_style(array("LivelyChatSupport-chatbox-reset", "LivelyChatSupport-chatbox-style", "LivelyChatSupport-chatbox-colours", "LivelyChatSupport-admin-css", "wp-color-picker", "LivelyChatSupport-jQuery-UI"));
    wp_register_script("LivelyChatSupport-admin-js", plugins_url("lively-chat-support/admin/js/admin.js"));
    wp_enqueue_script(array("jquery", "jquery-ui", "jquery-ui-datepicker", "wp-color-picker", "LivelyChatSupport-admin-js"));
    wp_enqueue_media();
    if (isset($_POST)) {
        if (function_exists("flush_pgcache")) {
            flush_pgcache();
        }
        if (function_exists("reset_oc_version")) {
            reset_oc_version();
        }
        $posted_data = array();
        $post_fields = array("subscriber_email", "subscriber_name", "default_responder_id", "visible_pages", "online", "offline_thanks", "colour", "position", "cta_online_text", "cta_offline_text", "cta_online_image_offset_y", "cta_online_image_offset_x", "cta_offline_image_offset_y", "cta_offline_image_offset_x", "cta_online_image", "cta_offline_image", "start", "finish", "twilio_sid", "twilio_auth", "sms_responder_id", "show_powered_by", "track_pages");
        $allow_blanks = array();
        foreach ($post_fields as $field) {
            if (isset($_POST[$field])) {
                $posted_data[$field] = trim(stripslashes($_POST[$field]));
            }
        }
        LivelyChatSupport_settings($posted_data);
    }
    if (isset($_POST["activation_code"])) {
        LivelyChatSupport_activate();
    }
    if (isset($_GET["delete_convo"])) {
        LivelyChatSupport_delete_convo($_GET["convo_token"]);
    }
    if (isset($_POST["twilio_phone"])) {
        $agent = LivelyChatSupport_agent(get_current_user_id());
        LivelyChatSupport_settings(array("twilio_phone" => "+" . preg_replace("/[^0-9]/", "", trim($_POST["twilio_phone"]))));
        LivelyChatSupport_send_sms("Site", "Your Lively Chat Support is installed!", $agent);
    }
    if (isset($_POST["agents"])) {
        foreach ($_POST["agents"] as $agent) {
            $active = $agent["active"] == "true" ? true : false;
            if (isset($agent["mobile"]) && $agent["mobile"] != "") {
                update_user_meta($agent["id"], "livelychatsupport-mobile", "+" . preg_replace("/[^0-9]/", "", trim($agent["mobile"])));
            }
            if (isset($agent["avatar"])) {
                update_user_meta($agent["id"], "livelychatsupport-avatar", $agent["avatar"]);
            }
            if (isset($agent["name"])) {
                update_user_meta($agent["id"], "livelychatsupport-name", $agent["name"]);
            }
            if (isset($agent["active"])) {
                update_user_meta($agent["id"], "livelychatsupport-active", $active);
            }
            if ($active) {
                $user = new WP_User($agent["id"]);
                $user->add_cap("can_livelychatsupport");
            } else {
                $user = new WP_User($agent["id"]);
                $user->remove_cap("can_livelychatsupport");
            }
        }
    }
    if (isset($_POST["triggers"])) {
        foreach ($_POST["triggers"] as $trigger) {
            $now = date("Y-m-d H:i:s", current_time("timestamp"));
            if ($trigger["id"] != "template") {
                if ($trigger["delete"] == "1") {
                    $wpdb->delete($wpdb->prefix . "livelychatsupport_triggers", array("id" => $trigger["id"]));
                } else {
                    if ($trigger["body"] != "") {
                        if ($trigger["id"] == "new") {
                            $wpdb->insert($wpdb->prefix . "livelychatsupport_triggers", array("urls" => $trigger["urls"], "delay" => $trigger["delay"], "body" => filter_var($trigger["body"], FILTER_SANITIZE_STRING), "created_at" => $now, "updated_at" => $now));
                        } else {
                            $wpdb->update($wpdb->prefix . "livelychatsupport_triggers", array("urls" => $trigger["urls"], "delay" => $trigger["delay"], "body" => filter_var($trigger["body"], FILTER_SANITIZE_STRING), "updated_at" => $now), array("id" => $trigger["id"]));
                        }
                    }
                }
            }
        }
    }
    if (isset($_POST["surveys"])) {
        foreach ($_POST["surveys"] as $survey) {
            $now = date("Y-m-d H:i:s", current_time("timestamp"));
            $questions = stripslashes($survey["questions"]);
            $title = stripslashes($survey["title"]);
            $urls = stripslashes($survey["urls"]);
            $delay = stripslashes($survey["delay"]);
            $thanks = stripslashes($survey["thanks"]);
            if ($survey["id"] != "template") {
                if ($survey["delete"] == "1") {
                    $wpdb->delete($wpdb->prefix . "livelychatsupport_surveys", array("id" => $survey["id"]));
                } else {
                    if ($title != "") {
                        if ($survey["id"] == "new") {
                            $wpdb->insert($wpdb->prefix . "livelychatsupport_surveys", array("title" => $title, "urls" => $urls, "delay" => $delay, "questions" => $questions, "thanks" => $thanks, "created_at" => $now, "updated_at" => $now));
                        } else {
                            $wpdb->update($wpdb->prefix . "livelychatsupport_surveys", array("title" => $title, "urls" => $urls, "delay" => $delay, "questions" => $questions, "thanks" => $thanks, "updated_at" => $now), array("id" => $survey["id"]));
                        }
                    }
                }
            }
        }
    }
    if (isset($_POST["hours"])) {
        foreach ($_POST["hours"] as $hour) {
            $now = date("Y-m-d H:i:s", current_time("timestamp"));
            if (isset($hour["id"])) {
                if ($hour["id"] != "template") {
                    if ($hour["delete"] == "1") {
                        $wpdb->delete($wpdb->prefix . "livelychatsupport_hours", array("id" => $hour["id"]));
                    } else {
                        if ($hour["id"] == "new") {
                            $wpdb->insert($wpdb->prefix . "livelychatsupport_hours", array("day" => $hour["day"], "open_at" => date("Hi", strtotime($hour["open_at"])), "close_at" => date("Hi", strtotime($hour["close_at"])), "responder_id" => $hour["responder_id"], "via" => $hour["via"], "created_at" => $now, "updated_at" => $now));
                        } else {
                            $wpdb->update($wpdb->prefix . "livelychatsupport_hours", array("day" => $hour["day"], "open_at" => date("Hi", strtotime($hour["open_at"])), "close_at" => date("Hi", strtotime($hour["close_at"])), "responder_id" => $hour["responder_id"], "via" => $hour["via"], "updated_at" => $now), array("id" => $hour["id"]));
                        }
                    }
                }
            }
        }
    }
    $livelychatsupport = LivelyChatSupport_details();
    echo '<div id="livelychatsupport" class="wrap">';
    include_once LIVELYCHATSUPPORT_ROOT . "/admin/includes/header.php";
    if ($livelychatsupport["subscriber_email"] == "" || $livelychatsupport["subscriber_name"] == "") {
        include_once LIVELYCHATSUPPORT_ROOT . "/admin/tabs/email_required.php";
    } else {
        $_GET["tab"] = isset($_GET["tab"]) ? $_GET["tab"] : "visitors";
        include_once LIVELYCHATSUPPORT_ROOT . "/admin/tabs/" . $_GET["tab"] . ".php";
    }
    echo '</div>';
}
function wp_cache_post_change($post_id)
{
    global $file_prefix, $cache_path, $blog_id, $super_cache_enabled, $blog_cache_dir, $blogcacheid;
    static $last_processed = -1;
    if ($post_id == $last_processed) {
        return $post_id;
    }
    $last_processed = $post_id;
    if (!wp_cache_writers_entry()) {
        return $post_id;
    }
    if ($wp_cache_object_cache) {
        reset_oc_version();
    }
    $permalink = trailingslashit(str_replace(get_option('siteurl'), '', post_permalink($post_id)));
    if ($super_cache_enabled) {
        $siteurl = trailingslashit(strtolower(preg_replace('/:.*$/', '', str_replace('http://', '', get_option('home')))));
        // make sure the front page has a rebuild file
        if (isset($GLOBALS['wp_super_cache_debug']) && $GLOBALS['wp_super_cache_debug']) {
            wp_cache_debug("Post change: deleting cache files in " . $cache_path . 'supercache/' . $siteurl, 4);
        }
        prune_super_cache($cache_path . 'supercache/' . $siteurl . 'index.html', true, true);
        prune_super_cache($cache_path . 'supercache/' . $siteurl . 'index.html.gz', true, true);
        wp_cache_post_id_gc($siteurl, $post_id);
        if (get_option('show_on_front') == 'page') {
            wp_cache_post_id_gc($siteurl, get_option('page_on_front'));
            wp_cache_post_id_gc($siteurl, get_option('page_for_posts'));
        }
    }
    $matches = array();
    if ($handle = @opendir($blog_cache_dir . 'meta/')) {
        while (false !== ($file = readdir($handle))) {
            if (preg_match("/^({$file_prefix}{$blogcacheid}.*)\\.meta/", $file, $matches)) {
                $meta_pathname = $blog_cache_dir . 'meta/' . $file;
                $content_pathname = $blog_cache_dir . $matches[1] . ".html";
                $meta = unserialize(@file_get_contents($meta_pathname));
                if (false == is_array($meta)) {
                    @unlink($meta_pathname);
                    @unlink($content_pathname);
                    continue;
                }
                if ($post_id > 0 && $meta) {
                    if ($meta['blog_id'] == $blog_id && (!$meta['post'] || $meta['post'] == $post_id)) {
                        @unlink($meta_pathname);
                        @unlink($content_pathname);
                        @wp_cache_rebuild_or_delete($cache_path . 'supercache/' . trailingslashit($meta['uri']) . 'index.html');
                        @wp_cache_rebuild_or_delete($cache_path . 'supercache/' . trailingslashit($meta['uri']) . 'index.html.gz');
                    }
                } elseif ($meta['blog_id'] == $blog_id) {
                    @unlink($meta_pathname);
                    @unlink($content_pathname);
                    @wp_cache_rebuild_or_delete($cache_path . 'supercache/' . trailingslashit($meta['uri']) . 'index.html');
                    @wp_cache_rebuild_or_delete($cache_path . 'supercache/' . trailingslashit($meta['uri']) . 'index.html.gz');
                }
            }
        }
        closedir($handle);
    }
    wp_cache_writers_exit();
    return $post_id;
}
Esempio n. 10
0
function wp_cache_post_change($post_id)
{
    global $file_prefix, $cache_path, $blog_id, $super_cache_enabled, $blog_cache_dir, $blogcacheid, $wp_cache_refresh_single_only, $wp_cache_object_cache;
    static $last_processed = -1;
    if ($post_id == $last_processed) {
        wp_cache_debug("wp_cache_post_change: Already processed post {$post_id}.", 4);
        return $post_id;
    }
    $post = get_post($post_id);
    // Some users are inexplicibly seeing this error on scheduled posts.
    // define this constant to disable the post status check.
    if (false == defined('WPSCFORCEUPDATE') && is_object($post) && $post->post_status != 'publish') {
        wp_cache_debug("wp_cache_post_change: draft post, not deleting any cache files.", 4);
        return $post_id;
    }
    $last_processed = $post_id;
    if (!wp_cache_writers_entry()) {
        return $post_id;
    }
    if (isset($wp_cache_refresh_single_only) && $wp_cache_refresh_single_only && (strpos($_SERVER['HTTP_REFERER'], 'edit-comments.php') || strpos($_SERVER['REQUEST_URI'], 'wp-comments-post.php'))) {
        if (defined('DONOTDELETECACHE')) {
            wp_cache_debug("wp_cache_post_change: comment detected and it's moderated or spam. Not deleting cached files.", 4);
            return $post_id;
        } else {
            wp_cache_debug("wp_cache_post_change: comment detected. only deleting post page.", 4);
            $all = false;
        }
    } else {
        $all = true;
    }
    if ($wp_cache_object_cache) {
        reset_oc_version();
    }
    $permalink = trailingslashit(str_replace(get_option('siteurl'), '', post_permalink($post_id)));
    if ($super_cache_enabled) {
        $dir = get_supercache_dir();
        $siteurl = trailingslashit(strtolower(preg_replace('/:.*$/', '', str_replace('https://', '', str_replace('http://', '', get_option('home'))))));
        // make sure the front page has a rebuild file
        wp_cache_post_id_gc($siteurl, $post_id);
        if ($all == true) {
            wp_cache_debug("Post change: supercache enabled: deleting cache files in " . $cache_path . 'supercache/' . $siteurl, 4);
            $files_to_check = get_all_supercache_filenames($dir);
            foreach ($files_to_check as $cache_file) {
                wp_cache_debug("Post change: deleting cache file: " . $dir . $cache_file, 4);
                prune_super_cache($dir . $cache_file, true, true);
            }
            do_action('gc_cache', 'prune', 'homepage');
        } else {
            wp_cache_debug("wp_cache_post_change: not deleting all pages.", 4);
        }
        if ($all == true && get_option('show_on_front') == 'page') {
            wp_cache_debug("Post change: deleting page_on_front and page_for_posts pages.", 4);
            wp_cache_debug("Post change: page_on_front " . get_option('page_on_front'), 4);
            wp_cache_post_id_gc($siteurl, get_option('page_on_front'), 'single');
            $permalink = trailingslashit(str_replace(get_option('home'), '', post_permalink(get_option('page_for_posts'))));
            $files_to_check = get_all_supercache_filenames($dir . $permalink);
            foreach ($files_to_check as $cache_file) {
                prune_super_cache($dir . $permalink . $cache_file, true, true);
            }
            do_action('gc_cache', 'prune', $permalink);
        } else {
            wp_cache_debug("wp_cache_post_change: not deleting front static page.", 4);
        }
    }
    wp_cache_debug("wp_cache_post_change: checking {$blog_cache_dir}meta/", 4);
    $matches = array();
    if ($handle = @opendir($blog_cache_dir . 'meta/')) {
        while (false !== ($file = readdir($handle))) {
            if (preg_match("/^({$file_prefix}{$blogcacheid}.*)\\.meta/", $file, $matches)) {
                $meta_pathname = $blog_cache_dir . 'meta/' . $file;
                $content_pathname = $blog_cache_dir . $matches[1] . ".html";
                $meta = unserialize(@file_get_contents($meta_pathname));
                if (false == is_array($meta)) {
                    wp_cache_debug("Post change cleaning up stray file: {$content_pathname}", 4);
                    @unlink($meta_pathname);
                    @unlink($content_pathname);
                    continue;
                }
                if ($post_id > 0 && $meta) {
                    $permalink = trailingslashit(str_replace(get_option('home'), '', post_permalink($post_id)));
                    if ($meta['blog_id'] == $blog_id && ($all == true && !$meta['post'] || $meta['post'] == $post_id)) {
                        wp_cache_debug("Post change: deleting post cache files for {$meta['uri']}: {$content_pathname}", 4);
                        @unlink($meta_pathname);
                        @unlink($content_pathname);
                        if ($super_cache_enabled == true) {
                            @prune_super_cache($dir . $permalink, true, true);
                            do_action('gc_cache', 'rebuild', $permalink);
                        }
                    }
                } elseif ($meta['blog_id'] == $blog_id) {
                    wp_cache_debug("Post change: deleting cache files for {$meta['uri']}: {$content_pathname}", 4);
                    @unlink($meta_pathname);
                    @unlink($content_pathname);
                    if ($super_cache_enabled == true) {
                        $files_to_check = get_all_supercache_filenames($dir . $meta['uri']);
                        foreach ($files_to_check as $cache_file) {
                            @wp_cache_rebuild_or_delete($dir . trailingslashit($meta['uri']) . $cache_file);
                        }
                        do_action('gc_cache', 'rebuild', trailingslashit($meta['uri']));
                    }
                }
            }
        }
        closedir($handle);
    }
    wp_cache_writers_exit();
    return $post_id;
}