/** * Clear the caches! */ function ccfm_clear_cache_for_me($source) { global $wp_fastest_cache; do_action('ccfm_clear_cache_for_me_before', $source); // if W3 Total Cache is being used, clear the cache if (function_exists('w3tc_pgcache_flush')) { w3tc_pgcache_flush(); } else { if (function_exists('wp_cache_clean_cache')) { global $file_prefix, $supercachedir; if (empty($supercachedir) && function_exists('get_supercache_dir')) { $supercachedir = get_supercache_dir(); } wp_cache_clean_cache($file_prefix); } else { if (class_exists('WpeCommon')) { //be extra careful, just in case 3rd party changes things on us if (method_exists('WpeCommon', 'purge_memcached')) { WpeCommon::purge_memcached(); } if (method_exists('WpeCommon', 'purge_memcached')) { WpeCommon::clear_maxcdn_cache(); } if (method_exists('WpeCommon', 'purge_memcached')) { WpeCommon::purge_varnish_cache(); } } else { if (method_exists('WpFastestCache', 'deleteCache') && !empty($wp_fastest_cache)) { $wp_fastest_cache->deleteCache(); } } } } do_action('ccfm_clear_cache_for_me', $source); }
static function run() { error_log('pl5 - run() at ' . __CLASS__); if (!class_exists('WpeCommon')) { return false; } WpeCommon::purge_memcached(); WpeCommon::clear_maxcdn_cache(); WpeCommon::purge_varnish_cache(); error_log('pl5 - cleared WPE caches.'); }
/** * Clear cache from: * - W3TC, * - WordPress Total Cache * - WPEngine * - Varnish */ public function clear_cache() { /** * if W3 Total Cache is being used, clear the cache */ if (function_exists('w3tc_pgcache_flush')) { w3tc_pgcache_flush(); } else { if (function_exists('wp_cache_clean_cache')) { global $file_prefix; wp_cache_clean_cache($file_prefix); } else { if (class_exists('WpeCommon')) { WpeCommon::purge_memcached(); WpeCommon::clear_maxcdn_cache(); WpeCommon::purge_varnish_cache(); } } } /** * Clear Varnish caches */ if ('file' == $this->mode() && Avada()->settings->get('cache_server_ip')) { $this->clear_varnish_cache($this->file('url')); } }
public static function purge_varnish_cache_all() { WpeCommon::purge_varnish_cache(); }
if (is_a($msg, 'WP_Error')) { return false; } if (!isset($msg['body'])) { return false; } $data = json_decode($msg['body'], true); $message = @$data['message']; } // Process purging all caches if (wpe_param('purge-all')) { check_admin_referer(PWP_NAME . '-config'); // check_admin_referer(PWP_NAME.'-config'); DO NOT CHECK because it's OK to just hit it from anywhere, and in fact we do. WpeCommon::purge_memcached(); WpeCommon::clear_maxcdn_cache(); WpeCommon::purge_varnish_cache(); // refresh our own cache (after CDN purge, in case that needed to clear before we access new content) $message = "All of these caches have been purged: HTML-page-caching, CDN (statics), and WordPress Object/Transient Caches."; } if (is_wpe_snapshot()) { $error = "Cannot use the standard WPEngine controls from a staging server!<br/><br/>This is valid only from your live site."; $have_snapshot = FALSE; } else { $snapshot_state = $plugin->get_staging_status(); if ($just_started_snapshot && $snapshot_state['have_snapshot']) { // if this, fake it! $snapshot_state['status'] = "Starting the staging snapshot process..."; $snapshot_state['is_ready'] = false; } $have_snapshot = (bool) $snapshot_state['have_snapshot']; }
private function clear_cache_plugins() { /* Not implemented yet - still testing */ /*** * Automatically clears page caches after plugin install or upgrade * Called from upgrade_check() * Added 1.9.6.2 ***/ global $wpss_cache_check, $wp_fastest_cache; if (empty($wpss_cache_check)) { $wpss_cache_check = rs_wpss_check_cache_status(); } if ($wpss_cache_check['cache_check_status'] === 'ACTIVE') { if (rs_wpss_is_plugin_active('w3-total-cache/w3-total-cache.php') && function_exists('w3tc_pgcache_flush')) { /* W3 Total Cache */ w3tc_pgcache_flush(); } if (rs_wpss_is_plugin_active('wp-super-cache/wp-cache.php') && function_exists('wp_cache_clean_cache')) { /* WP Super Cache */ global $file_prefix; wp_cache_clean_cache($file_prefix); } if (rs_wpss_is_plugin_active('wp-fastest-cache/wpFastestCache.php') && !empty($wp_fastest_cache) && method_exists('WpFastestCache', 'deleteCache')) { /* WP Fastest Cache */ $wp_fastest_cache->deleteCache(); } if (class_exists('WPE_API', FALSE) && class_exists('WpeCommon')) { /* WP Engine Hosting */ if (method_exists('WpeCommon', 'purge_memcached')) { WpeCommon::purge_memcached(); } if (method_exists('WpeCommon', 'clear_maxcdn_cache')) { WpeCommon::clear_maxcdn_cache(); } if (method_exists('WpeCommon', 'purge_varnish_cache')) { WpeCommon::purge_varnish_cache(); } } } }
private function clear_cache_plugins() { /* Not fully implemented yet - still testing */ /** * Automatically clears page caches after plugin install or upgraded * Called from upgrade_check() * Added 1.9.6.2, Modified 1.9.7.5 */ global $wpss_cache_check, $wp_fastest_cache, $file_prefix, $supercachedir; /* Flush Memcache(d) */ $flush_memcache = wp_cache_flush(); return; /* Temp - 1.9.7.5 */ /* Check if cache plugins or server-side caching active */ if (empty($wpss_cache_check)) { $wpss_cache_check = rs_wpss_check_cache_status(); } if ($wpss_cache_check['cache_check_status'] === 'ACTIVE') { if (WPSS_Compatibility::is_plugin_active('w3-total-cache/w3-total-cache.php') && function_exists('w3tc_pgcache_flush')) { /* W3 Total Cache */ w3tc_pgcache_flush(); } if (WPSS_Compatibility::is_plugin_active('wp-super-cache/wp-cache.php') && function_exists('wp_cache_clean_cache')) { /* WP Super Cache */ if (empty($supercachedir) && function_exists('get_supercache_dir')) { $supercachedir = get_supercache_dir(); } wp_cache_clean_cache($file_prefix); } if (WPSS_Compatibility::is_plugin_active('wp-fastest-cache/wpFastestCache.php') && method_exists('WpFastestCache', 'deleteCache') && !empty($wp_fastest_cache)) { /* WP Fastest Cache */ $wp_fastest_cache->deleteCache(); } if (class_exists('WPE_API', FALSE) && class_exists('WpeCommon')) { /* WP Engine Hosting */ if (method_exists('WpeCommon', 'purge_memcached')) { WpeCommon::purge_memcached(); } if (method_exists('WpeCommon', 'clear_maxcdn_cache')) { WpeCommon::clear_maxcdn_cache(); } if (method_exists('WpeCommon', 'purge_varnish_cache')) { WpeCommon::purge_varnish_cache(); } } /* Add Autoptimize & other Cache Plugins... */ } }
function autoptimize_flush_pagecache() { 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(); } else { if (function_exists('wp_fast_cache_bulk_delete_all')) { wp_fast_cache_bulk_delete_all(); // still to retest } else { if (class_exists("WpFastestCache")) { $wpfc = new WpFastestCache(); $wpfc->deleteCache(); } else { if (class_exists("c_ws_plugin__qcache_purging_routines")) { c_ws_plugin__qcache_purging_routines::purge_cache_dir(); // quick cache, still to retest } else { if (class_exists("zencache")) { zencache::clear(); } else { if (class_exists("comet_cache")) { comet_cache::clear(); } else { if (class_exists("WpeCommon")) { if (apply_filters('autoptimize_flush_wpengine_aggressive', false)) { if (method_exists("WpeCommon", "purge_memcached")) { WpeCommon::purge_memcached(); } if (method_exists("WpeCommon", "clear_maxcdn_cache")) { WpeCommon::clear_maxcdn_cache(); } } if (method_exists("WpeCommon", "purge_varnish_cache")) { WpeCommon::purge_varnish_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); } } } } } } } } } } } }
/** * Clear cache from: * - W3TC, * - WordPress Total Cache * - WPEngine * - Varnish */ public function clear_cache() { // if W3 Total Cache is being used, clear the cache if (function_exists('w3tc_pgcache_flush')) { w3tc_pgcache_flush(); } else { if (function_exists('wp_cache_clean_cache')) { global $file_prefix; wp_cache_clean_cache($file_prefix); } else { if (class_exists('WpeCommon')) { WpeCommon::purge_memcached(); WpeCommon::clear_maxcdn_cache(); WpeCommon::purge_varnish_cache(); } } } // Clear Varnish caches if (Avada()->settings->get('dynamic_css_compiler') && Avada()->settings->get('cache_server_ip')) { $this->clear_varnish_cache(self::file('url')); } }
$msg = $http->get( $url ); if ( is_a( $msg, 'WP_Error' ) ) return false; if ( ! isset( $msg['body'] ) ) return false; $data = json_decode( $msg['body'], true ); $message = @$data['message']; } // Process purging all caches if ( wpe_param( 'purge-all' ) ) { check_admin_referer( PWP_NAME . '-config' ); // check_admin_referer(PWP_NAME.'-config'); DO NOT CHECK because it's OK to just hit it from anywhere, and in fact we do. WpeCommon::purge_memcached(); WpeCommon::clear_maxcdn_cache(); WpeCommon::purge_varnish_cache(); // refresh our own cache (after CDN purge, in case that needed to clear before we access new content) $message = "All of these caches have been purged: HTML-page-caching, CDN (statics), and WordPress Object/Transient Caches."; } if ( is_wpe_snapshot() ) { $error = "Cannot use the standard WPEngine controls from a staging server!<br/><br/>This is valid only from your live site."; $have_snapshot = FALSE; } else { $snapshot_state = $plugin->get_staging_status(); if ( $just_started_snapshot && $snapshot_state['have_snapshot'] ) { // if this, fake it! $snapshot_state['status'] = "Starting the staging snapshot process..."; $snapshot_state['is_ready'] = false; } $have_snapshot = (bool) $snapshot_state['have_snapshot']; }?>
/** * Call the cache server to purge the cache with WP Engine hosting. * * @since 2.6.4 * * @return void */ function rocket_clean_wpengine() { if (class_exists('WpeCommon')) { WpeCommon::purge_memcached(); WpeCommon::purge_varnish_cache(); } }