MDL-50491 filters: Eliminate un-resettable static caching.

This was breaking unit tests. I think it is no longer necessary since
get_config now has good caching of its own.
This commit is contained in:
Tim Hunt 2015-06-17 12:49:22 +01:00
parent 7d94679ff1
commit 41e5e524f9
2 changed files with 2 additions and 50 deletions

View File

@ -32,14 +32,6 @@ defined('MOODLE_INTERNAL') || die();
class filter_emoticon extends moodle_text_filter {
/**
* @var array global configuration for this filter
*
* This might be eventually moved into parent class if we found it
* useful for other filters, too.
*/
protected static $globalconfig;
/**
* Apply the filter to the text
*
@ -77,27 +69,7 @@ class filter_emoticon extends moodle_text_filter {
* @return string|object|null
*/
protected function get_global_config($name=null) {
$this->load_global_config();
if (is_null($name)) {
return self::$globalconfig;
} elseif (array_key_exists($name, self::$globalconfig)) {
return self::$globalconfig->{$name};
} else {
return null;
}
}
/**
* Makes sure that the global config is loaded in $this->globalconfig
*
* @return void
*/
protected function load_global_config() {
if (is_null(self::$globalconfig)) {
self::$globalconfig = get_config(get_class($this));
}
return get_config(get_class($this), $name);
}
/**

View File

@ -72,27 +72,7 @@ class filter_urltolink extends moodle_text_filter {
* @return string|object|null
*/
protected function get_global_config($name=null) {
$this->load_global_config();
if (is_null($name)) {
return self::$globalconfig;
} elseif (array_key_exists($name, self::$globalconfig)) {
return self::$globalconfig->{$name};
} else {
return null;
}
}
/**
* Makes sure that the global config is loaded in $this->globalconfig
*
* @return void
*/
protected function load_global_config() {
if (is_null(self::$globalconfig)) {
self::$globalconfig = get_config('filter_urltolink');
}
return get_config('filter_urltolink', $name);
}
/**