From d98bbcbbe6371d299a810c92a127cd9ebe573d98 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Wed, 9 Sep 2020 14:04:05 +0800 Subject: [PATCH] MDL-42012 cache: Fully disable cache for disabled cache factory --- cache/classes/factory.php | 2 +- cache/disabledlib.php | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/cache/classes/factory.php b/cache/classes/factory.php index 07d7b358280..a974377932d 100644 --- a/cache/classes/factory.php +++ b/cache/classes/factory.php @@ -450,7 +450,7 @@ class cache_factory { if (!$definition) { throw new coding_exception('The requested cache definition does not exist.'. $id, $id); } - if (!$this->is_disabled() && !($this instanceof cache_factory_disabled)) { + if (!$this->is_disabled()) { debugging('Cache definitions reparsed causing cache reset in order to locate definition. You should bump the version number to ensure definitions are reprocessed.', DEBUG_DEVELOPER); } diff --git a/cache/disabledlib.php b/cache/disabledlib.php index 1883fccdb72..0a2d7965445 100644 --- a/cache/disabledlib.php +++ b/cache/disabledlib.php @@ -327,6 +327,15 @@ class cache_factory_disabled extends cache_factory { // Return the instance. return $this->configs[$class]; } + + /** + * Returns true if the cache API has been disabled. + * + * @return bool + */ + public function is_disabled() { + return true; + } } /**