mirror of
https://github.com/moodle/moodle.git
synced 2025-04-26 10:54:21 +02:00
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:
parent
7d94679ff1
commit
41e5e524f9
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user