MDL-66903 core: Add option to get core in list of components

Note: This change is backported from MDL-81063.
This commit is contained in:
Andrew Nicols
2024-07-15 12:22:19 +08:00
parent 651ecb52d9
commit 9e71503ab3
2 changed files with 45 additions and 16 deletions
+13 -10
View File
@@ -1329,18 +1329,16 @@ $cache = '.var_export($cache, true).';
}
/**
* Returns a list of frankenstyle component names.
* Returns a list of frankenstyle component names, including all plugins, subplugins, and subsystems.
*
* E.g.
* [
* 'core_course',
* 'core_message',
* 'mod_assign',
* ...
* ]
* @return array the list of frankenstyle component names.
* Note: By default the 'core' subsystem is not included.
*
* @param bool $includecore Whether to include the 'core' subsystem
* @return string[] the list of frankenstyle component names.
*/
public static function get_component_names() : array {
public static function get_component_names(
bool $includecore = false
): array {
$componentnames = [];
// Get all plugins.
foreach (self::get_plugin_types() as $plugintype => $typedir) {
@@ -1352,6 +1350,11 @@ $cache = '.var_export($cache, true).';
foreach (self::get_core_subsystems() as $subsystemname => $subsystempath) {
$componentnames[] = 'core_' . $subsystemname;
}
if ($includecore) {
$componentnames[] = 'core';
}
return $componentnames;
}