From 53ae22b99341c5bd4806099a00716ec7ac1958f6 Mon Sep 17 00:00:00 2001 From: Andrew Robert Nicols Date: Mon, 18 Mar 2013 23:52:39 +0000 Subject: [PATCH] MDL-38391 lib: Also include core subsystems in YUI_config.modules --- lib/outputrequirementslib.php | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/lib/outputrequirementslib.php b/lib/outputrequirementslib.php index 28445b4346c..48bc0f71a34 100644 --- a/lib/outputrequirementslib.php +++ b/lib/outputrequirementslib.php @@ -1194,7 +1194,7 @@ class page_requirements_manager { /** * This class represents the YUI configuration. * - * @copyright 2013 Anderw Nicols + * @copyright 2013 Andrew Nicols * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @since Moodle 2.5 * @package core @@ -1379,13 +1379,26 @@ class YUI_config { */ private function get_moodle_metadata() { $moodlemodules = array(); - // Core isn't a plugin type - handle it seperately. + // Core isn't a plugin type or subsystem - handle it seperately. if ($module = $this->get_moodle_path_metadata(get_component_directory('core'))) { $moodlemodules = array_merge($moodlemodules, $module); } - $subsystems = get_plugin_types(); - foreach ($subsystems as $plugintype => $pathroot) { + // Handle other core subsystems. + $subsystems = get_core_subsystems(); + foreach ($subsystems as $subsystem => $path) { + if (is_null($path)) { + continue; + } + $path = get_component_directory($subsystem); + if ($module = $this->get_moodle_path_metadata($path)) { + $moodlemodules = array_merge($moodlemodules, $module); + } + } + + // And finally the plugins. + $plugintypes = get_plugin_types(); + foreach ($plugintypes as $plugintype => $pathroot) { $pluginlist = get_plugin_list($plugintype); foreach ($pluginlist as $plugin => $path) { if ($module = $this->get_moodle_path_metadata($path)) { @@ -1414,6 +1427,9 @@ class YUI_config { continue; } $metafile = realpath($baseyui . '/' . $item . '/meta/' . $item . '.json'); + if (!is_readable($metafile)) { + continue; + } $metadata = file_get_contents($metafile); $modules = array_merge($modules, (array) json_decode($metadata)); }