ACF.php
1 year ago
AdvancedMathCaptcha.php
1 year ago
AeliaCurrencySwitcher.php
11 months ago
BeaverBuilder.php
1 year ago
CF_Helper.php
1 year ago
CURCY_MultiCurrency.php
1 year ago
Cloudflare.php
1 year ago
CommonHelpers.php
1 year ago
CookieNotice.php
1 year ago
DownloadManager.php
1 year ago
Elementor.php
6 months ago
Ezoic.php
1 year ago
FusionBuilder.php
1 year ago
GeoTargetingWP.php
1 year ago
GravityForms.php
1 year ago
JetPackNP.php
1 year ago
MPG.php
11 months ago
NginxHelper.php
1 year ago
RC.php
11 months ago
RankMathNP.php
1 year ago
ShortPixel.php
1 year ago
SquirrlySEO.php
1 year ago
TheEventsCalendar.php
1 year ago
ThriveTheme.php
1 year ago
WCML.php
1 year ago
WPBakeryNP.php
1 year ago
WPCacheHelper.php
1 year ago
WPForms.php
1 year ago
WPML.php
1 year ago
WPRocket.php
1 year ago
WooCommerce.php
11 months ago
WoocommerceCacheHandler.php
1 year ago
YoastSEO.php
1 year ago
WPRocket.php
42 lines
| 1 | <?php |
| 2 | |
| 3 | namespace NitroPack\Integration\Plugin; |
| 4 | |
| 5 | class WPRocket extends RC { |
| 6 | |
| 7 | private static $cpath = ['/wp-rocket/' => false,]; //We are only interested in the page cache (other cache dirs '/busting/', '/critical-css/', '/min/') |
| 8 | |
| 9 | public static function hasResidualCache() { |
| 10 | $wpc_dir = self::getWPCacheDir(); |
| 11 | $curr_domain = self::getCurrentDomain(); |
| 12 | if ($wpc_dir && $curr_domain) { |
| 13 | $prefix = defined('WP_ROCKET_CACHE_ROOT_PATH') ? nitropack_trailingslashit(WP_ROCKET_CACHE_ROOT_PATH) : $wpc_dir; |
| 14 | foreach (self::$cpath as $cp => $recursive_scan) { |
| 15 | $fcp = $prefix . $cp; |
| 16 | if ($cp === '/wp-rocket/') { |
| 17 | $fcp = $prefix . $cp . $curr_domain; |
| 18 | } |
| 19 | return self::dirHasContents($fcp, $recursive_scan); |
| 20 | } |
| 21 | } |
| 22 | return false; |
| 23 | } |
| 24 | |
| 25 | public static function clearCache() { |
| 26 | $wpc_dir = self::getWPCacheDir(); |
| 27 | $curr_domain = self::getCurrentDomain(); |
| 28 | $result = array(); |
| 29 | if ($wpc_dir && $curr_domain) { |
| 30 | $prefix = defined('WP_ROCKET_CACHE_ROOT_PATH') ? nitropack_trailingslashit(WP_ROCKET_CACHE_ROOT_PATH) : $wpc_dir; |
| 31 | foreach (self::$cpath as $cp => $recursive_scan) { |
| 32 | $fcp = $prefix . $cp; |
| 33 | if ($cp === '/wp-rocket/') { |
| 34 | $fcp = $prefix . $cp . $curr_domain; |
| 35 | } |
| 36 | $result[] = self::clearResidualCache($fcp); |
| 37 | } |
| 38 | } |
| 39 | return $result; |
| 40 | } |
| 41 | } |
| 42 |