MDL-42012 cache: Fully disable cache for disabled cache factory
authorAndrew Nicols <andrew@nicols.co.uk>
Wed, 9 Sep 2020 06:04:05 +0000 (14:04 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Wed, 9 Sep 2020 06:04:05 +0000 (14:04 +0800)
cache/classes/factory.php
cache/disabledlib.php

index 07d7b35..a974377 100644 (file)
@@ -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);
                         }
index 1883fcc..0a2d796 100644 (file)
@@ -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;
+    }
 }
 
 /**