From c79e42374cd36e2e0a09e7877786bf1ec29e226b Mon Sep 17 00:00:00 2001 From: Raam Dev Date: Sat, 27 Dec 2014 15:31:36 -0500 Subject: [PATCH] Add filter to allow cache locking to be disabled. See websharks/quick-cache#387 --- quick-cache-pro/includes/share.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/quick-cache-pro/includes/share.php b/quick-cache-pro/includes/share.php index b2d77ccf..afcc38de 100644 --- a/quick-cache-pro/includes/share.php +++ b/quick-cache-pro/includes/share.php @@ -1789,7 +1789,7 @@ public function delete_all_files_dirs_in($dir, $delete_dir_too = FALSE) * * @since 140422 First documented version. * - * @return array Lock type & resource handle needed to unlock later. + * @return array Lock type & resource handle needed to unlock later or FALSE if disabled by filter. * * @throws \exception If {@link \sem_get()} not available and there's * no writable tmp directory for {@link \flock()} either. @@ -1801,6 +1801,9 @@ public function delete_all_files_dirs_in($dir, $delete_dir_too = FALSE) */ public function cache_lock() { + if((boolean)apply_filters('quick_cache_disable_cache_locking', FALSE)) + return false; + if(!($wp_config_file = $this->find_wp_config_file())) throw new \exception(__('Unable to find the wp-config.php file.', $this->text_domain)); @@ -1831,6 +1834,9 @@ public function cache_lock() */ public function cache_unlock(array $lock) { + if((boolean)apply_filters('quick_cache_disable_cache_locking', FALSE)) + return; + if(!is_array($lock)) return; // Not possible.