AdvancedMathCaptcha.php
3 years ago
AeliaCurrencySwitcher.php
3 years ago
BeaverBuilder.php
4 years ago
CF_Helper.php
3 years ago
Cloudflare.php
2 years ago
CommonHelpers.php
3 years ago
CookieNotice.php
4 years ago
DownloadManager.php
4 years ago
Elementor.php
3 years ago
Ezoic.php
4 years ago
FusionBuilder.php
4 years ago
GeoTargetingWP.php
2 years ago
GravityForms.php
2 years ago
JetPackNP.php
3 years ago
NginxHelper.php
2 years ago
RC.php
3 years ago
RankMathNP.php
3 years ago
RocketNet_Helper.php
4 years ago
ShortPixel.php
4 years ago
SquirrlySEO.php
3 years ago
TheEventsCalendar.php
3 years ago
ThriveTheme.php
4 years ago
WCML.php
3 years ago
WPBakeryNP.php
3 years ago
WPCacheHelper.php
3 years ago
WPForms.php
3 years ago
WPRocket.php
4 years ago
Woocommerce.php
4 years ago
WoocommerceCacheHandler.php
4 years ago
YoastSEO.php
3 years 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 |