Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'wip-MDL-38387-m24' of git://github.com/samhemelryk/mood…

…le into MOODLE_24_STABLE
  • Loading branch information...
commit 3ab41b977919aa580f77d4b19baeef8efa084809 2 parents 6e2f8aa + bf07f4e
@damyon damyon authored
Showing with 15 additions and 6 deletions.
  1. +14 −5 cache/classes/factory.php
  2. +1 −1  cache/classes/helper.php
View
19 cache/classes/factory.php
@@ -103,7 +103,7 @@ class cache_factory {
* An array of lock plugins.
* @var array
*/
- protected $lockplugins = null;
+ protected $lockplugins = array();
/**
* The current state of the cache API.
@@ -155,7 +155,7 @@ public static function reset() {
$factory->stores = array();
$factory->configs = array();
$factory->definitions = array();
- $factory->lockplugins = null; // MUST be null in order to force its regeneration.
+ $factory->lockplugins = array(); // MUST be null in order to force its regeneration.
// Reset the state to uninitialised.
$factory->state = self::STATE_UNINITIALISED;
}
@@ -406,7 +406,7 @@ public function create_definition($component, $area, $aggregate = null) {
$definition = $instance->get_definition_by_id($id);
if (!$definition) {
throw new coding_exception('The requested cache definition does not exist.'. $id, $id);
- } else {
+ } else if (!$this->is_disabled()) {
debugging('Cache definitions reparsed causing cache reset in order to locate definition.
You should bump the version number to ensure definitions are reprocessed.', DEBUG_DEVELOPER);
}
@@ -442,6 +442,7 @@ protected function create_dummy_store(cache_definition $definition) {
* @return cache_lock_interface
*/
public function create_lock_instance(array $config) {
+ global $CFG;
if (!array_key_exists('name', $config) || !array_key_exists('type', $config)) {
throw new coding_exception('Invalid cache lock instance provided');
}
@@ -450,8 +451,16 @@ public function create_lock_instance(array $config) {
unset($config['name']);
unset($config['type']);
- if ($this->lockplugins === null) {
- $this->lockplugins = get_plugin_list_with_class('cachelock', '', 'lib.php');
+ if (!isset($this->lockplugins[$type])) {
+ $pluginname = substr($type, 10);
+ $file = $CFG->dirroot."/cache/locks/{$pluginname}/lib.php";
+ if (file_exists($file) && is_readable($file)) {
+ require_once($file);
+ }
+ if (!class_exists($type)) {
+ throw new coding_exception('Invalid lock plugin requested.');
+ }
+ $this->lockplugins[$type] = $type;
}
if (!array_key_exists($type, $this->lockplugins)) {
throw new coding_exception('Invalid cache lock type.');
View
2  cache/classes/helper.php
@@ -548,7 +548,7 @@ public static function get_site_identifier() {
// If the site identifier is still null then config isn't aware of it yet.
// We'll see if the CFG is loaded, and if not we will just use unknown.
// It's very important here that we don't use get_config. We don't want an endless cache loop!
- if (isset($CFG->siteidentifier)) {
+ if (!empty($CFG->siteidentifier)) {
self::$siteidentifier = self::update_site_identifier($CFG->siteidentifier);
} else {
// It's not being recorded in MUC's config and the config data hasn't been loaded yet.
Please sign in to comment.
Something went wrong with that request. Please try again.