From 10c8e6ffe4024b909dc600a3b6ff705a462f6d5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20St=C3=B6ckl?= Date: Wed, 31 Jan 2018 11:37:52 +0100 Subject: [PATCH] feat. do_action for cache wipe / clear / purge --- src/includes/traits/Plugin/WcpUtils.php | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/includes/traits/Plugin/WcpUtils.php b/src/includes/traits/Plugin/WcpUtils.php index 2bdf1a4..1ec5d27 100644 --- a/src/includes/traits/Plugin/WcpUtils.php +++ b/src/includes/traits/Plugin/WcpUtils.php @@ -29,6 +29,8 @@ trait WcpUtils */ public function wipeCache($manually = false) { + do_action('comet_cache_wipe_cache'); + $counter = 0; // Initialize. if (!$manually && $this->disableAutoWipeCacheRoutines()) { @@ -40,11 +42,11 @@ public function wipeCache($manually = false) $regex = $this->assembleCachePathRegex('', '.+'); $counter += $this->wipeFilesFromCacheDir($regex); } - - - + + + return $counter; } @@ -70,6 +72,9 @@ public function wipe_cache() */ public function clearCache($manually = false) { + + do_action('comet_cache_clear_cache'); + $counter = 0; // Initialize. if (!$manually && $this->disableAutoClearCacheRoutines()) { @@ -81,11 +86,11 @@ public function clearCache($manually = false) $regex = $this->buildHostCachePathRegex('', '.+'); $counter += $this->clearFilesFromHostCacheDir($regex); } - - - + + + return $counter; } @@ -111,6 +116,8 @@ public function clear_cache() */ public function purgeCache($manually = false) { + do_action('comet_cache_purge_cache'); + $counter = 0; // Initialize. if (!$manually && $this->disableAutoPurgeCacheRoutines()) { @@ -122,7 +129,7 @@ public function purgeCache($manually = false) $regex = $this->buildHostCachePathRegex('', '.+'); $counter += $this->purgeFilesFromHostCacheDir($regex); } - + return $counter; } @@ -159,7 +166,7 @@ public function wurgeCache($manually = false) $regex = $this->assembleCachePathRegex('', '.+'); $counter += $this->wurgeFilesFromCacheDir($regex); } - + return $counter; } @@ -380,4 +387,4 @@ public function disableAutoPurgeCacheRoutines() } return $is_disabled; } -} +} \ No newline at end of file