Skip to content

Commit 7e94d11

Browse files
committed
Added action hooks on wipe, clear, purge, wurge
New actions: rapid_cache_wipe_cache, rapid_cache_clear_cache, rapid_cache_purge_cache, rapid_cache_wurge_cache
1 parent e31ef9e commit 7e94d11

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

includes/src/Traits/Plugin/WcpUtils.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,9 @@ public function wipeCache($manually = false)
4040
$regex = $this->assembleCachePathRegex('', '.+');
4141
$counter += $this->wipeFilesFromCacheDir($regex);
4242
}
43-
4443

45-
44+
$this->doWpAction(MEGAOPTIM_RAPID_CACHE_GLOBAL_NS.'_wipe_cache', $counter);
4645

47-
4846
return $counter;
4947
}
5048

@@ -81,11 +79,9 @@ public function clearCache($manually = false)
8179
$regex = $this->buildHostCachePathRegex('', '.+');
8280
$counter += $this->clearFilesFromHostCacheDir($regex);
8381
}
84-
8582

86-
83+
$this->doWpAction(MEGAOPTIM_RAPID_CACHE_GLOBAL_NS.'_clear_cache', $counter);
8784

88-
8985
return $counter;
9086
}
9187

@@ -122,6 +118,8 @@ public function purgeCache($manually = false)
122118
$regex = $this->buildHostCachePathRegex('', '.+');
123119
$counter += $this->purgeFilesFromHostCacheDir($regex);
124120
}
121+
122+
$this->doWpAction(MEGAOPTIM_RAPID_CACHE_GLOBAL_NS.'_purge_cache', $counter);
125123

126124
return $counter;
127125
}
@@ -159,7 +157,9 @@ public function wurgeCache($manually = false)
159157
$regex = $this->assembleCachePathRegex('', '.+');
160158
$counter += $this->wurgeFilesFromCacheDir($regex);
161159
}
162-
160+
161+
$this->doWpAction(MEGAOPTIM_RAPID_CACHE_GLOBAL_NS.'_wurge_cache', $counter);
162+
163163
return $counter;
164164
}
165165

readme.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,4 +243,6 @@ Released under the terms of the [GNU General Public License](http://www.gnu.org/
243243
- Fix: 'Non static method should not be called statically
244244
- Fix: 'Headers already sent' warnings
245245
- Fix: 'Notice: id was called incorrectly. Product properties should not be accessed directly.' warning with WooCommerce
246-
- New: Add Referrer-Policy to cacheable headers list
246+
- Fix: Warnings when disk_*_space functions are disabled
247+
- New: Add Referrer-Policy to cacheable headers list
248+
- New: Add actions: rapid_cache_wipe_cache, rapid_cache_clear_cache, rapid_cache_purge_cache, rapid_cache_wurge_cache

0 commit comments

Comments
 (0)