diff --git a/cache/locallib.php b/cache/locallib.php index 6110eb705f7..f52570e310b 100644 --- a/cache/locallib.php +++ b/cache/locallib.php @@ -340,32 +340,7 @@ class cache_config_writer extends cache_config { require_once($CFG->dirroot.'/cache/stores/static/lib.php'); $writer = new self; - $writer->configstores = array( - 'default_application' => array( - 'name' => 'default_application', - 'plugin' => 'file', - 'configuration' => array(), - 'features' => cachestore_file::get_supported_features(), - 'modes' => cachestore_file::get_supported_modes(), - 'default' => true, - ), - 'default_session' => array( - 'name' => 'default_session', - 'plugin' => 'session', - 'configuration' => array(), - 'features' => cachestore_session::get_supported_features(), - 'modes' => cachestore_session::get_supported_modes(), - 'default' => true, - ), - 'default_request' => array( - 'name' => 'default_request', - 'plugin' => 'static', - 'configuration' => array(), - 'features' => cachestore_static::get_supported_features(), - 'modes' => cachestore_static::get_supported_modes(), - 'default' => true, - ) - ); + $writer->configstores = self::get_default_stores(); $writer->configdefinitions = self::locate_definitions(); $writer->configmodemappings = array( array( @@ -404,6 +379,52 @@ class cache_config_writer extends cache_config { return true; } + /** + * Returns an array of default stores for use. + * + * @return array + */ + protected static function get_default_stores() { + return array( + 'default_application' => array( + 'name' => 'default_application', + 'plugin' => 'file', + 'configuration' => array(), + 'features' => cachestore_file::get_supported_features(), + 'modes' => cachestore_file::get_supported_modes(), + 'default' => true, + ), + 'default_session' => array( + 'name' => 'default_session', + 'plugin' => 'session', + 'configuration' => array(), + 'features' => cachestore_session::get_supported_features(), + 'modes' => cachestore_session::get_supported_modes(), + 'default' => true, + ), + 'default_request' => array( + 'name' => 'default_request', + 'plugin' => 'static', + 'configuration' => array(), + 'features' => cachestore_static::get_supported_features(), + 'modes' => cachestore_static::get_supported_modes(), + 'default' => true, + ) + ); + } + + /** + * Updates the default stores within the MUC config file. + */ + public static function update_default_config_stores() { + $factory = cache_factory::instance(); + $factory->updating_started(); + $config = $factory->create_config_instance(true); + $config->configstores = array_merge($config->configstores, self::get_default_stores()); + $config->config_save(); + $factory->updating_finished(); + } + /** * Updates the definition in the configuration from those found in the cache files. * diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index b568bff1fe5..c28e4569e65 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -2117,5 +2117,13 @@ function xmldb_main_upgrade($oldversion) { upgrade_main_savepoint(true, 2013041601.01); } + if ($oldversion < 2013041900.00) { + require_once($CFG->dirroot.'/cache/locallib.php'); + // The features bin needs updating. + cache_config_writer::update_default_config_stores(); + // Main savepoint reached. + upgrade_main_savepoint(true, 2013041900.00); + } + return true; } diff --git a/version.php b/version.php index 4e4583f7aa1..0a1f6e028d8 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2013041801.00; // YYYYMMDD = weekly release date of this DEV branch +$version = 2013041900.00; // YYYYMMDD = weekly release date of this DEV branch // RR = release increments - 00 in DEV branches // .XX = incremental changes