Merge branch 'wip-MDL-36363-m25' of https://github.com/samhemelryk/moodle
[moodle.git] / cache / locallib.php
index 8a015ee..ce926a5 100644 (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,12 @@ 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;