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.
This commit is contained in:
Sam Hemelryk 2013-05-08 15:38:14 +12:00
parent 919a8db0a2
commit c6ec9309fa

14
cache/disabledlib.php vendored
View File

@ -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);
}