From 4584a2a043b5e60c03ee63c86f0ba458e16343dd Mon Sep 17 00:00:00 2001 From: Florian Delizy Date: Tue, 4 Jul 2023 10:22:45 +0800 Subject: [PATCH] fixing cache break edge case and force invalidate when this happens --- action.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/action.php b/action.php index fd6f150..fa88cba 100644 --- a/action.php +++ b/action.php @@ -204,6 +204,7 @@ function _doreplace(&$event, $param) { */ function _cache_control(&$event, $param) { global $conf; + global $ID; $cache =& $event->data; @@ -212,6 +213,15 @@ function _cache_control(&$event, $param) { $const = p_get_metadata($cache->page, 'plugin_const'); //force initial purge + if (is_string($const)) { + // something went wrong in the cache, fix the cache value + // and force invalidate for the time being + $const = array( + 'invalidate' => true + ); + + p_set_metadata($ID, array( 'plugin_const' => $const), false, true); + } if (!isset($const['invalidate'])) { $const['invalidate'] = true; }