MDL-63658 core: new method get_component_names() added to core

This commit is contained in:
Jake Dallimore
2018-10-18 08:22:07 +08:00
parent b7a3ec6f8d
commit 3a1ece149f
2 changed files with 54 additions and 0 deletions
+27
View File
@@ -1278,4 +1278,31 @@ $cache = '.var_export($cache, true).';
}
return $components;
}
/**
* Returns a list of frankenstyle component names.
*
* E.g.
* [
* 'core_course',
* 'core_message',
* 'mod_assign',
* ...
* ]
* @return array the list of frankenstyle component names.
*/
public static function get_component_names() : array {
$componentnames = [];
// Get all plugins.
foreach (self::get_plugin_types() as $plugintype => $typedir) {
foreach (self::get_plugin_list($plugintype) as $pluginname => $plugindir) {
$componentnames[] = $plugintype . '_' . $pluginname;
}
}
// Get all subsystems.
foreach (self::get_core_subsystems() as $subsystemname => $subsystempath) {
$componentnames[] = 'core_' . $subsystemname;
}
return $componentnames;
}
}