PluginProbe
Autoptimize / 2.3.1
Autoptimize v2.3.1
2.2.2 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.5.0 2.5.1 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 All 107 releases
autoptimize / classlesses / autoptimizePageCacheFlush.php

autoptimizePageCacheFlush.php in Autoptimize 2.3.1, at classlesses/autoptimizePageCacheFlush.php

56 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // flush as many page cache plugin's caches as possible
3 // hyper cache and gator cache hook into AO, so we don't need to :-)
4
5 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
6
7 function autoptimize_flush_pagecache() {
8 if(function_exists('wp_cache_clear_cache')) {
9 if (is_multisite()) {
10 $blog_id = get_current_blog_id();
11 wp_cache_clear_cache($blog_id);
12 } else {
13 wp_cache_clear_cache();
14 }
15 } else if ( has_action('cachify_flush_cache') ) {
16 do_action('cachify_flush_cache');
17 } else if ( function_exists('w3tc_pgcache_flush') ) {
18 w3tc_pgcache_flush();
19 } else if ( function_exists('wp_fast_cache_bulk_delete_all') ) {
20 wp_fast_cache_bulk_delete_all(); // still to retest
21 } else if (class_exists("WpFastestCache")) {
22 $wpfc = new WpFastestCache();
23 $wpfc -> deleteCache();
24 } else if ( class_exists("c_ws_plugin__qcache_purging_routines") ) {
25 c_ws_plugin__qcache_purging_routines::purge_cache_dir(); // quick cache, still to retest
26 } else if ( class_exists("zencache") ) {
27 zencache::clear();
28 } else if ( class_exists("comet_cache") ) {
29 comet_cache::clear();
30 } else if ( class_exists("WpeCommon") ) {
31 if ( apply_filters('autoptimize_flush_wpengine_aggressive', false) ) {
32 if ( method_exists( "WpeCommon", "purge_memcached" ) ) {
33 WpeCommon::purge_memcached();
34 }
35 if ( method_exists( "WpeCommon", "clear_maxcdn_cache" ) ) {
36 WpeCommon::clear_maxcdn_cache();
37 }
38 }
39 if ( method_exists( "WpeCommon", "purge_varnish_cache" ) ) {
40 WpeCommon::purge_varnish_cache();
41 }
42 } else if ( function_exists('sg_cachepress_purge_cache') ) {
43 sg_cachepress_purge_cache();
44 } else if(file_exists(WP_CONTENT_DIR.'/wp-cache-config.php') && function_exists('prune_super_cache')){
45 // fallback for WP-Super-Cache
46 global $cache_path;
47 if (is_multisite()) {
48 $blog_id = get_current_blog_id();
49 prune_super_cache( get_supercache_dir( $blog_id ), true );
50 prune_super_cache( $cache_path . 'blogs/', true );
51 } else {
52 prune_super_cache($cache_path.'supercache/',true);
53 prune_super_cache($cache_path,true);
54 }
55 }
56 }