From 0ef0eebe08c72f90be42d9b60a2afd638b531a1b Mon Sep 17 00:00:00 2001 From: Philipp <32090713+ouun@users.noreply.github.com> Date: Tue, 30 Nov 2021 22:00:20 +0100 Subject: [PATCH] Add Befure Cached File Purged Action This is a equivalent for direct file purging of the very useful hook `rt_nginx_helper_before_remote_purge_url`. To fire an action before purging a cached file. --- admin/class-purger.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/admin/class-purger.php b/admin/class-purger.php index 22d5689c..420df28a 100644 --- a/admin/class-purger.php +++ b/admin/class-purger.php @@ -404,6 +404,16 @@ protected function delete_cache_file_for( $url ) { * @param string $cached_file Cached file name. */ $cached_file = apply_filters( 'rt_nginx_helper_purge_cached_file', $cached_file ); + + /** + * Fire an action before purging cached file. + * + * @since 2.2.3 + * + * @param string $url URL to be purged. + * @param string $cached_file Cached file name. + */ + do_action( 'rt_nginx_helper_before_purge_cached_file', $url, $cached_file ); // Verify cached file exists. if ( ! file_exists( $cached_file ) ) {