MDL-36363 Added cache_store::instance_created() and cache_store::instance_deleted()

This commit is contained in:
Matteo Scaramuccia
2013-01-28 10:39:22 +13:00
committed by Sam Hemelryk
parent b3778a0dec
commit 730cf5acbc
2 changed files with 31 additions and 0 deletions
+9
View File
@@ -178,6 +178,10 @@ class cache_config_writer extends cache_config {
$this->configstores[$name]['lock'] = $configuration['lock'];
unset($this->configstores[$name]['configuration']['lock']);
}
// Call instance_created()
$store = new $class($name, $this->configstores[$name]['configuration']);
$store->instance_created();
$this->config_save();
return true;
}
@@ -304,6 +308,11 @@ class cache_config_writer extends cache_config {
throw new cache_exception('You cannot delete a cache store that has definition mappings.');
}
}
// Call instance_deleted()
$class = 'cachestore_'.$this->configstores[$name]['plugin'];
$store = new $class($name, $this->configstores[$name]['configuration']);
$store->instance_deleted();
unset($this->configstores[$name]);
$this->config_save();
return true;