Merge branch 'wip-MDL-36363-m25' of https://github.com/samhemelryk/moodle
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 29 Jan 2013 11:06:33 +0000 (12:06 +0100)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 29 Jan 2013 11:06:33 +0000 (12:06 +0100)
1  2 
cache/locallib.php

diff --combined cache/locallib.php
@@@ -178,6 -178,10 +178,10 @@@ class cache_config_writer extends cache
              $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;
      }
                  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;
       * @param bool $coreonly If set to true only core definitions will be updated.
       */
      public static function update_definitions($coreonly = false) {
 -        $config = self::instance();
 +        $factory = cache_factory::instance();
 +        $factory->updating_started();
 +        $config = $factory->create_config_instance(true);
          $config->write_definitions_to_cache(self::locate_definitions($coreonly));
 +        $factory->updating_finished();
      }
  
      /**
@@@ -698,10 -705,6 +708,10 @@@ abstract class cache_administration_hel
                  array(
                      'text' => get_string('editmappings', 'cache'),
                      'url' => new moodle_url('/cache/admin.php', array('action' => 'editdefinitionmapping', 'sesskey' => sesskey()))
 +                ),
 +                array(
 +                    'text' => get_string('purge', 'cache'),
 +                    'url' => new moodle_url('/cache/admin.php', array('action' => 'purgedefinition', 'sesskey' => sesskey()))
                  )
              );
          }
              }
              $actions[] = array(
                  'text' => get_string('purge', 'cache'),
 -                'url' => new moodle_url($baseurl, array('action' => 'purge'))
 +                'url' => new moodle_url($baseurl, array('action' => 'purgestore'))
              );
          }
          return $actions;