From c6ec9309fa2ca83ee64842b4c6263d2810ffecab Mon Sep 17 00:00:00 2001 From: Sam Hemelryk Date: Wed, 8 May 2013 15:38:14 +1200 Subject: [PATCH] MDL-39526 cache: now re-parses definitions during upgrade. The solution to this issue was to make the disabled cache factory return a proper cache writer object when requested rather than a disabled cache object. This only changes things when CACHE_DISABLE_ALL has been defined. --- cache/disabledlib.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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); }