当前位置: 首页>>代码示例>>PHP>>正文


PHP reset_oc_version函数代码示例

本文整理汇总了PHP中reset_oc_version函数的典型用法代码示例。如果您正苦于以下问题:PHP reset_oc_version函数的具体用法?PHP reset_oc_version怎么用?PHP reset_oc_version使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了reset_oc_version函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: clear_cache_wpsupercache

 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;
     }
 }
开发者ID:nikintharan,项目名称:campaign,代码行数:16,代码来源:restorer.php

示例2: wp_cache_clean_cache

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);
    }
}
开发者ID:popovdenis,项目名称:kmst,代码行数:34,代码来源:wp-cache.php

示例3: clearCache

 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 '';
     }
 }
开发者ID:venturepact,项目名称:blog,代码行数:23,代码来源:admin.class.php

示例4: wp_cache_clean_cache

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);
    }
}
开发者ID:hoonio,项目名称:wordpress,代码行数:35,代码来源:wp-cache.php

示例5: get_oc_version

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'];
}
开发者ID:JuiceCrawl,项目名称:juicecrawldev,代码行数:10,代码来源:wp-cache-phase1.php

示例6: wp_cache_clean_cache

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);
}
开发者ID:jordankoschei,项目名称:jordankoschei-dot-com,代码行数:24,代码来源:wp-cache.php

示例7: wp_cache_post_change

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) {
//.........这里部分代码省略.........
开发者ID:rubyerme,项目名称:rubyerme.github.com,代码行数:101,代码来源:wp-cache-phase2.php

示例8: LivelyChatSupport_admin

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"]));
                        }
                    }
//.........这里部分代码省略.........
开发者ID:vinayakac,项目名称:lively-chat-support,代码行数:101,代码来源:functions.php

示例9: wp_cache_post_change

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;
}
开发者ID:simpsonjulian,项目名称:puppet-wordpress,代码行数:61,代码来源:wp-cache-phase2.php

示例10: wp_cache_post_change

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']));
                    }
//.........这里部分代码省略.........
开发者ID:jnylin,项目名称:wp-super-cache,代码行数:101,代码来源:wp-cache-phase2.php


注:本文中的reset_oc_version函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。