MDL-86376 core: Make public static functions more resilient

a
This commit is contained in:
Dan Marsden
2025-10-16 20:45:50 +13:00
parent 7abebfa820
commit fb9d6e718d
+4
View File
@@ -1366,6 +1366,7 @@ $cache = ' . var_export($cache, true) . ';
public static function get_plugin_list_with_file($plugintype, $file, $include = false) {
global $CFG; // Necessary in case it is referenced by included PHP scripts.
$pluginfiles = [];
self::init();
if (isset(self::$filemap[$file])) {
// If the file was supposed to be mapped, then it should have been set in the array.
@@ -1407,6 +1408,7 @@ $cache = ' . var_export($cache, true) . ';
public static function get_component_classes_in_namespace($component = null, $namespace = '') {
$classes = [];
self::init();
// Only look for components if a component name is set or a namespace is set.
if (isset($component) || !empty($namespace)) {
@@ -1815,6 +1817,7 @@ $cache = ' . var_export($cache, true) . ';
* @return bool true if core subsystem.
*/
public static function is_core_subsystem($subsystemname) {
self::init();
return isset(self::$subsystems[$subsystemname]);
}
@@ -1825,6 +1828,7 @@ $cache = ' . var_export($cache, true) . ';
* @return bool true if core API.
*/
public static function is_core_api($apiname) {
self::init();
return isset(self::$apis[$apiname]);
}