• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP prune_super_cache函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: domain_mapping_gc_cache

function domain_mapping_gc_cache($function, $directory)
{
    global $cache_path;
    if (!function_exists('domain_mapping_warning')) {
        return false;
    }
    $siteurl = domain_mapping_siteurl(false);
    if (!$siteurl) {
        return false;
    }
    $protocol = 'on' == strtolower($_SERVER['HTTPS']) ? 'https://' : 'http://';
    $siteurl = trailingslashit(str_replace($protocol, '', $siteurl));
    if ($directory == 'homepage') {
        $directory = '';
    }
    switch ($function) {
        case "rebuild":
            @wp_cache_rebuild_or_delete($cache_path . 'supercache/' . $siteurl . $directory . 'index.html');
            @wp_cache_rebuild_or_delete($cache_path . 'supercache/' . $siteurl . $directory . 'index.html.gz');
            break;
        case "prune":
            prune_super_cache($cache_path . 'supercache/' . $siteurl . $directory . 'index.html', true, true);
            prune_super_cache($cache_path . 'supercache/' . $siteurl . $directory . 'index.html.gz', true, true);
            break;
    }
    return $directory;
}
开发者ID:hacklabr,项目名称:toquenobrasil,代码行数:27,代码来源:domain-mapping.php


示例2: bp_core_clear_cache

/**
 * REQUIRES WP-SUPER-CACHE
 *
 * When wp-super-cache is installed this function will clear cached pages
 * so that success/error messages are not cached, or time sensitive content.
 *
 * @package BuddyPress Core
 */
function bp_core_clear_cache()
{
    global $cache_path, $cache_filename;
    if (function_exists('prune_super_cache')) {
        do_action('bp_core_clear_cache');
        return prune_super_cache($cache_path, true);
    }
}
开发者ID:hornetalcala,项目名称:trunk,代码行数:16,代码来源:bp-core-cache.php


示例3: reset_caches

 function reset_caches()
 {
     global $cache_path, $file_prefix;
     if (function_exists('prune_super_cache')) {
         prune_super_cache($cache_path, true);
     }
     if (function_exists('wp_cache_clean_cache')) {
         wp_cache_clean_cache($file_prefix);
     }
 }
开发者ID:dparks-seattletimes,项目名称:openworldstudios,代码行数:10,代码来源:Livefyre_Application.php


示例4: bp_core_clear_cache

/**
 * Prune the WP Super Cache.
 *
 * @see prune_super_cache()
 *
 * When wp-super-cache is installed this function will clear cached pages
 * so that success/error messages are not cached, or time sensitive content.
 *
 * @return int
 */
function bp_core_clear_cache()
{
    global $cache_path;
    if (function_exists('prune_super_cache')) {
        /**
         * Fires before the pruning of WP Super Cache.
         *
         * @since BuddyPress (1.0.0)
         */
        do_action('bp_core_clear_cache');
        return prune_super_cache($cache_path, true);
    }
}
开发者ID:AceMedia,项目名称:BuddyPress,代码行数:23,代码来源:bp-core-cache.php


示例5: wppa_clear_cache

function wppa_clear_cache($force = false)
{
    global $cache_path;
    // If wp-super-cache is on board, clear cache
    if (function_exists('prune_super_cache')) {
        prune_super_cache($cache_path . 'supercache/', true);
        prune_super_cache($cache_path, true);
    }
    // W3 Total cache
    if (function_exists('w3tc_pgcache_flush')) {
        w3tc_pgcache_flush();
    }
    // SG_CachePress
    /*
    if ( class_exists( 'SG_CachePress_Supercacher' ) ) {
    	$c = new SG_CachePress_Supercacher();
    	@ $c->purge_cache();
    }
    */
    // Quick cache
    if (isset($GLOBALS['quick_cache'])) {
        $GLOBALS['quick_cache']->clear_cache();
    }
    // At a setup or update operation
    // Manually remove the content of wp-content/cache/
    if ($force) {
        if (is_dir(WPPA_CONTENT_PATH . '/cache/')) {
            wppa_tree_empty(WPPA_CONTENT_PATH . '/cache');
        }
    }
}
开发者ID:billadams,项目名称:forever-frame,代码行数:31,代码来源:wppa-common-functions.php


示例6: 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


示例7: 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


示例8: 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


示例9: clearall

 static function clearall()
 {
     //Cache not available :(
     if (!autoptimizeCache::cacheavail()) {
         return false;
     }
     //Clean the cachedir
     $scan = scandir(AUTOPTIMIZE_CACHE_DIR);
     foreach ($scan as $file) {
         if (!in_array($file, array('.', '..')) && strpos($file, 'autoptimize') !== false && is_file(AUTOPTIMIZE_CACHE_DIR . $file)) {
             @unlink(AUTOPTIMIZE_CACHE_DIR . $file);
         }
     }
     //Do we need to clean WP Super Cache's cache files?
     if (function_exists('wp_cache_clear_cache')) {
         //Newer WP-Super-Cache
         //See http://ocaoimh.ie/wp-super-cache-developers/
         wp_cache_clear_cache();
     } elseif (file_exists(WP_CONTENT_DIR . '/wp-cache-config.php') && function_exists('prune_super_cache')) {
         //Old WP-Super-Cache
         global $cache_path;
         prune_super_cache($cache_path . 'supercache/', true);
         prune_super_cache($cache_path, true);
     }
     return true;
 }
开发者ID:SSRezhepa,项目名称:prodvizhenie.ru,代码行数:26,代码来源:autoptimizeCache.php


示例10: flush_version

 /**
  *
  *  Flush rewrites/cached css
  *
  *  @package PageLines DMS
  *  @since 2.2
  */
 static function flush_version($rules = true)
 {
     $types = array('sections', 'core', 'custom');
     $folder = trailingslashit(pl_get_css_dir('path'));
     if ('1' == pl_setting('alternative_css')) {
         $file = 'compiled-css-core.css';
     } else {
         $file = sprintf('compiled-css-core-%s.css', get_theme_mod('pl_save_version'));
     }
     if (is_file($folder . $file)) {
         @unlink($folder . $file);
     }
     if ('1' == pl_setting('alternative_css')) {
         $file = 'compiled-css-sections.css';
     } else {
         $file = sprintf('compiled-css-sections-%s.css', get_theme_mod('pl_save_version'));
     }
     if (is_file($folder . $file)) {
         @unlink($folder . $file);
     }
     // Attempt to flush super-cache and w3 cache.
     if (function_exists('prune_super_cache')) {
         global $cache_path;
         $GLOBALS["super_cache_enabled"] = 1;
         prune_super_cache($cache_path . 'supercache/', true);
         prune_super_cache($cache_path, true);
     }
     if ($rules) {
         flush_rewrite_rules(true);
     }
     set_theme_mod('pl_save_version', time());
     $types = array('sections', 'core', 'custom');
     foreach ($types as $t) {
         $compiled = get_transient("pagelines_{$t}_css");
         $backup = get_transient("pagelines_{$t}_css_backup");
         if (!is_array($backup) && is_array($compiled) && strpos($compiled[$t], 'PARSE ERROR') === false) {
             set_transient("pagelines_{$t}_css_backup", $compiled, 604800);
         }
         delete_transient("pagelines_{$t}_css");
     }
 }
开发者ID:zakikazmi,项目名称:TestGithub,代码行数:48,代码来源:less.legacy.php


示例11: a_clear_super_cache

 function a_clear_super_cache()
 {
     if (function_exists('prune_super_cache')) {
         prune_super_cache(WP_CONTENT_DIR . '/cache/', true);
     }
 }
开发者ID:karlbright,项目名称:boilerplate-wp,代码行数:6,代码来源:common.php


示例12: flush_version

 /**
  *
  *  Flush rewrites/cached css
  *
  *  @package PageLines Framework
  *  @since 2.2
  */
 public static function flush_version($rules = true)
 {
     // Attempt to flush super-cache.
     if (function_exists('prune_super_cache')) {
         global $cache_path;
         $GLOBALS["super_cache_enabled"] = 1;
         prune_super_cache($cache_path . 'supercache/', true);
         prune_super_cache($cache_path, true);
     }
     // Attempt to flush w3 cache.
     if (class_exists('W3_Plugin_TotalCacheAdmin')) {
         $plugin_totalcacheadmin =& w3_instance('W3_Plugin_TotalCacheAdmin');
         $plugin_totalcacheadmin->flush_all();
     }
     if ($rules) {
         flush_rewrite_rules(true);
     }
     foreach (self::$types as $t) {
         $css_path = self::get_css_dir('path');
         foreach (array($t, "{$t}.min") as $type) {
             $filename = self::get_compiled_filename($type);
             $filepath = path_join($css_path, $filename);
             if (is_file($filepath)) {
                 @unlink($filepath);
             }
         }
         $compiled = get_transient("pagelines_{$t}_css");
         $backup = get_transient("pagelines_{$t}_css_backup");
         if (!is_array($backup) && is_array($compiled) && strpos($compiled[$t], 'PARSE ERROR') === false) {
             set_transient("pagelines_{$t}_css_backup", $compiled, 604800);
         }
         delete_transient("pagelines_{$t}_css");
     }
     set_theme_mod('pl_save_version', time());
 }
开发者ID:aaemnnosttv,项目名称:pagelines,代码行数:42,代码来源:class.render.css.php


示例13: clearCache

 /**
  * 캐시 플러그인의 캐시를 삭제한다.
  * @return boolen
  */
 public function clearCache()
 {
     global $cache_path;
     // WP-SUPER-CACHE
     if (function_exists('prune_super_cache')) {
         prune_super_cache($cache_path . 'supercache/', true);
         prune_super_cache($cache_path, true);
     }
 }
开发者ID:ksw2342,项目名称:kau_webstudio_12,代码行数:13,代码来源:class.controller.php


示例14: flush_plugin_caches

 /**
  * Flush Super Cache and W3 Total Cache
  * 
  * @return void
  **/
 public static function flush_plugin_caches()
 {
     if (function_exists('prune_super_cache')) {
         global $cache_path;
         prune_super_cache($cache_path . 'supercache/', true);
         prune_super_cache($cache_path, true);
     }
     if (class_exists('W3_Plugin_TotalCache')) {
         if (function_exists('w3_instance')) {
             $w3_plugin_totalcache =& w3_instance('W3_Plugin_TotalCache');
         } elseif (is_callable(array('W3_Plugin_TotalCache', 'instance'))) {
             $w3_plugin_totalcache =& W3_Plugin_TotalCache::instance();
         }
         if (method_exists($w3_plugin_totalcache, 'flush')) {
             $w3_plugin_totalcache->flush();
         } elseif (method_exists($w3_plugin_totalcache, 'flush_all')) {
             $w3_plugin_totalcache->flush_all();
         }
         /* Flush varnish */
         if (function_exists('w3tc_varnish_flush')) {
             w3tc_varnish_flush();
         }
     }
 }
开发者ID:danaiser,项目名称:hollandLawns,代码行数:29,代码来源:compiler.php


示例15: wp_cache_post_change

function wp_cache_post_change($post_id)
{
    global $file_prefix, $cache_path, $blog_id, $blogcacheid, $super_cache_enabled;
    static $last_processed = -1;
    if ($post_id == $last_processed) {
        return $post_id;
    }
    $last_processed = $post_id;
    if (!wp_cache_writers_entry()) {
        return $post_id;
    }
    $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
        prune_super_cache($cache_path . 'supercache/' . $siteurl . 'index.html', true, true);
        prune_super_cache($cache_path . 'supercache/' . $siteurl . 'index.html.gz', true, true);
        if ($post_id != 0) {
            $permalink = trailingslashit(str_replace(get_option('home'), '', post_permalink($post_id)));
            $dir = $cache_path . 'supercache/' . $siteurl;
            prune_super_cache($dir . $permalink, true, true);
            @rmdir($dir . $permalink);
            prune_super_cache($dir . 'page/', true);
        }
    }
    $meta = new CacheMeta();
    $matches = array();
    if ($handle = opendir($cache_path . 'meta/')) {
        while (false !== ($file = readdir($handle))) {
            if (preg_match("/^({$file_prefix}{$blogcacheid}.*)\\.meta/", $file, $matches)) {
                $meta_pathname = $cache_path . 'meta/' . $file;
                $content_pathname = $cache_path . $matches[1] . ".html";
                $meta = unserialize(@file_get_contents($meta_pathname));
                if ($post_id > 0 && $meta) {
                    if ($meta->blog_id == $blog_id && (!$meta->post || $meta->post == $post_id)) {
                        @unlink($meta_pathname);
                        @unlink($content_pathname);
                    }
                } elseif ($meta->blog_id == $blog_id) {
                    @unlink($meta_pathname);
                    @unlink($content_pathname);
                }
            }
        }
        closedir($handle);
    }
    wp_cache_writers_exit();
    return $post_id;
}
开发者ID:alx,项目名称:barceloneta,代码行数:49,代码来源:wp-cache-phase2.php


示例16: wp_cron_preload_cache

function wp_cron_preload_cache()
{
    global $wpdb, $wp_cache_preload_interval, $wp_cache_preload_posts, $wp_cache_preload_email_me, $wp_cache_preload_email_volume, $cache_path;
    if (get_option('preload_cache_stop')) {
        delete_option('preload_cache_stop');
        return true;
    }
    $mutex = $cache_path . "preload_mutex.tmp";
    sleep(3 + mt_rand(1, 5));
    if (@file_exists($mutex)) {
        if (@filemtime($mutex) > time() - 600) {
            return true;
        } else {
            @unlink($mutex);
        }
    }
    $fp = @fopen($mutex, 'w');
    @fclose($fp);
    $counter = get_option('preload_cache_counter');
    if (is_array($counter) == false) {
        $counter = array('c' => 0, 't' => time());
        update_option('preload_cache_counter', $counter);
    }
    $c = $counter['c'];
    if ($wp_cache_preload_email_me && $c == 0) {
        wp_mail(get_option('admin_email'), sprintf(__('[%1$s] Cache Preload Started', 'wp-super-cache'), site_url(), ''), ' ');
    }
    $taxonomies = apply_filters('wp_cache_preload_taxonomies', array('post_tag' => 'tag', 'category' => 'category'));
    $finished = false;
    $permalink_counter_msg = $cache_path . "preload_permalink.txt";
    foreach ($taxonomies as $taxonomy => $path) {
        $taxonomy_filename = $cache_path . "taxonomy_" . $taxonomy . ".txt";
        if ($c == 0) {
            @unlink($taxonomy_filename);
        }
        if (false == @file_exists($taxonomy_filename)) {
            $out = '';
            $records = get_terms($taxonomy);
            foreach ($records as $term) {
                $out .= site_url($path . "/" . $term->slug . "/") . "\n";
            }
            $fp = fopen($taxonomy_filename, 'w');
            if ($fp) {
                fwrite($fp, $out);
                fclose($fp);
            }
            $details = explode("\n", $out);
        } else {
            $details = explode("\n", file_get_contents($taxonomy_filename));
        }
        if (count($details) != 1 && $details[0] != '') {
            $rows = array_splice($details, 0, 50);
            if ($wp_cache_preload_email_me && $wp_cache_preload_email_volume == 'many') {
                wp_mail(get_option('admin_email'), sprintf(__('[%1$s] Refreshing %2$s taxonomy from %3$d to %4$d', 'wp-super-cache'), site_url(), $taxonomy, $c, $c + 100), 'Refreshing: ' . print_r($rows, 1));
            }
            foreach ((array) $rows as $url) {
                set_time_limit(60);
                if ($url == '') {
                    continue;
                }
                $url_info = parse_url($url);
                $dir = get_supercache_dir() . $url_info['path'];
                prune_super_cache($dir);
                $fp = @fopen($permalink_counter_msg, 'w');
                if ($fp) {
                    @fwrite($fp, "{$taxonomy}: {$url}");
                    @fclose($fp);
                }
                wp_remote_get($url, array('timeout' => 60, 'blocking' => true));
                sleep(1);
            }
            $fp = fopen($taxonomy_filename, 'w');
            if ($fp) {
                fwrite($fp, implode("\n", $details));
                fclose($fp);
            }
        }
    }
    if ($wp_cache_preload_posts == 'all' || $c <= $wp_cache_preload_posts) {
        $posts = $wpdb->get_col("SELECT ID FROM {$wpdb->posts} WHERE ( post_type != 'revision' AND post_type != 'nav_menu_item' ) AND post_status = 'publish' ORDER BY post_date DESC LIMIT {$c}, 100");
    } else {
        $posts = false;
    }
    if (!isset($wp_cache_preload_email_volume)) {
        $wp_cache_preload_email_volume = 'medium';
    }
    update_option('preload_cache_counter', array('c' => $c + 100, 't' => time()));
    if ($posts) {
        if ($wp_cache_preload_email_me && $wp_cache_preload_email_volume == 'many') {
            wp_mail(get_option('admin_email'), sprintf(__('[%1$s] Refreshing posts from %2$d to %3$d', 'wp-super-cache'), site_url(), $c, $c + 100), ' ');
        }
        $msg = '';
        $count = $c + 1;
        $permalink_counter_msg = $cache_path . "preload_permalink.txt";
        foreach ($posts as $post_id) {
            set_time_limit(60);
            clear_post_supercache($post_id);
            $url = get_permalink($post_id);
            $fp = @fopen($permalink_counter_msg, 'w');
            if ($fp) {
//.........这里部分代码省略.........
开发者ID:popovdenis,项目名称:kmst,代码行数:101,代码来源:wp-cache.php


示例17: clearall

 static function clearall()
 {
     if (!autoptimizeCache::cacheavail()) {
         return false;
     }
     // scan the cachedirs
     foreach (array("", "js", "css") as $scandirName) {
         $scan[$scandirName] = scandir(AUTOPTIMIZE_CACHE_DIR . $scandirName);
     }
     // clear the cachedirs
     foreach ($scan as $scandirName => $scanneddir) {
         $thisAoCacheDir = rtrim(AUTOPTIMIZE_CACHE_DIR . $scandirName, "/") . "/";
         foreach ($scanneddir as $file) {
             if (!in_array($file, array('.', '..')) && strpos($file, 'autoptimize') !== false && is_file($thisAoCacheDir . $file)) {
                 @unlink($thisAoCacheDir . $file);
             }
         }
     }
     @unlink(AUTOPTIMIZE_CACHE_DIR . "/.htaccess");
     // Do we need to clean any caching plugins cache-files?
     if (function_exists('wp_cache_clear_cache')) {
         if (is_multisite()) {
             $blog_id = get_current_blog_id();
             wp_cache_clear_cache($blog_id);
         } else {
             wp_cache_clear_cache();
         }
     } else {
         if (function_exists('w3tc_pgcache_flush')) {
             w3tc_pgcache_flush();
             // w3 total cache
         } else {
             if (function_exists('hyper_cache_invalidate')) {
                 hyper_cache_invalidate();
                 // hypercache
             } else {
                 if (function_exists('wp_fast_cache_bulk_delete_all')) {
                     wp_fast_cache_bulk_delete_all();
                     // wp fast cache
                 } else {
                     if (class_exists("WpFastestCache")) {
                         $wpfc = new WpFastestCache();
                         // wp fastest cache
                         $wpfc->deleteCache();
                     } else {
                         if (class_exists("c_ws_plugin__qcache_purging_routines")) {
                             c_ws_plugin__qcache_purging_routines::purge_cache_dir();
                             // quick cache
                         } else {
                             if (file_exists(WP_CONTENT_DIR . '/wp-cache-config.php') && function_exists('prune_super_cache')) {
                                 // fallback for WP-Super-Cache
                                 global $cache_path;
                                 if (is_multisite()) {
                                     $blog_id = get_current_blog_id();
                                     prune_super_cache(get_supercache_dir($blog_id), true);
                                     prune_super_cache($cache_path . 'blogs/', true);
                                 } else {
                                     prune_super_cache($cache_path . 'supercache/', true);
                                     prune_super_cache($cache_path, true);
                                 }
                             } else {
                                 // fallback; schedule event and try to clear there
                                 wp_schedule_single_event(time() + 1, 'ao_flush_pagecache', array(time()));
                             }
                         }
                     }
                 }
             }
         }
     }
     return true;
 }
开发者ID:FelixNong1990,项目名称:andy,代码行数:72,代码来源:autoptimizeCache.php


示例18: autoptimize_flush_pagecache

function autoptimize_flush_pagecache($nothing)
{
    if (function_exists('wp_cache_clear_cache')) {
        if (is_multisite()) {
            $blog_id = get_current_blog_id();
            wp_cache_clear_cache($blog_id);
        } else {
            wp_cache_clear_cache();
        }
    } else {
        if (has_action('cachify_flush_cache')) {
            do_action('cachify_flush_cache');
        } else {
            if (function_exists('w3tc_pgcache_flush')) {
                w3tc_pgcache_flush();
                // w3 total cache
            } else {
                if (function_exists('hyper_cache_invalidate')) {
                    hyper_cache_invalidate();
                    // hypercache
                } else {
                    if (function_exists('wp_fast_cache_bulk_delete_all')) {
                        wp_fast_cache_bulk_delete_all();
                        // wp fast cache
                    } else {
                        if (class_exists("WpFastestCache")) {
                            $wpfc = new WpFastestCache();
                            // wp fastest cache
                            $wpfc->deleteCache();
                        } else {
                            if (class_exists("c_ws_plugin__qcache_purging_routines")) {
                                c_ws_plugin__qcache_purging_routines::purge_cache_dir();
                                // quick cache
                            } else {
                                if (file_exists(WP_CONTENT_DIR . '/wp-cache-config.php') && function_exists('prune_super_cache')) {
                                    // fallback for WP-Super-Cache
                                    global $cache_path;
                                    if (is_multisite()) {
                                        $blog_id = get_current_blog_id();
                                        prune_super_cache(get_supercache_dir($blog_id), true);
                                        prune_super_cache($cache_path . 'blogs/', true);
                                    } else {
                                        prune_super_cache($cache_path . 'supercache/', true);
                                        prune_super_cache($cache_path, true);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
开发者ID:junaidkbr,项目名称:autoptimize,代码行数:54,代码来源:autoptimize.php


示例19: 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


示例20: 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;
    }
    $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 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ps函数代码示例发布时间:2022-05-15
下一篇:
PHP prune函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap