本文整理汇总了PHP中prune_super_cache函数的典型用法代码示例。如果您正苦于以下问题:PHP prune_super_cache函数的具体用法?PHP prune_super_cache怎么用?PHP prune_super_cache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prune_super_cache函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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');
}
}
}
示例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']));
}
//.........这里部分代码省略.........
示例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;
}
}
示例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 '';
}
}
示例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;
}
示例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");
}
}
示例11: a_clear_super_cache
function a_clear_super_cache()
{
if (function_exists('prune_super_cache')) {
prune_super_cache(WP_CONTENT_DIR . '/cache/', true);
}
}
示例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());
}
示例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);
}
}
示例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();
}
}
}
示例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;
}