mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 20:42:22 +02:00
MDL-38565 cache: upgrade code to amend default stores
This commit is contained in:
parent
059102e728
commit
fbf76dcd17
73
cache/locallib.php
vendored
73
cache/locallib.php
vendored
@ -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.
|
||||
*
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user