diff --git a/cache/disabledlib.php b/cache/disabledlib.php index 18cc11eb07d..1e95bbc466c 100644 --- a/cache/disabledlib.php +++ b/cache/disabledlib.php @@ -256,10 +256,22 @@ class cache_factory_disabled extends cache_factory { * @return cache_config|cache_config_writer */ public function create_config_instance($writer = false) { + // We are always going to use the cache_config_disabled class for all regular request. + // However if the code has requested the writer then likely something is changing and + // we're going to need to interact with the config.php file. + // In this case we will still use the cache_config_writer. $class = 'cache_config_disabled'; + if ($writer) { + // If the writer was requested then something is changing. + $class = 'cache_config_writer'; + } if (!array_key_exists($class, $this->configs)) { self::set_state(self::STATE_INITIALISING); - $configuration = $class::create_default_configuration(); + if (!$writer) { + $configuration = $class::create_default_configuration(); + } else { + $configuration = false; + } $this->configs[$class] = new $class; $this->configs[$class]->load($configuration); }