MDL-61875 core_privacy: update the core_component_list in the manager
authorJake Dallimore <jake@moodle.com>
Fri, 6 Apr 2018 02:09:33 +0000 (10:09 +0800)
committerJake Dallimore <jake@moodle.com>
Tue, 10 Apr 2018 00:44:42 +0000 (08:44 +0800)
privacy/classes/manager.php

index 0889f4a..04ae625 100644 (file)
@@ -298,22 +298,9 @@ class manager {
      * @return array the array of frankenstyle component names.
      */
     protected function get_component_list() {
-        $components = [];
-        // Get all plugins.
-        $plugintypes = \core_component::get_plugin_types();
-        foreach ($plugintypes as $plugintype => $typedir) {
-            $plugins = \core_component::get_plugin_list($plugintype);
-            foreach ($plugins as $pluginname => $plugindir) {
-                $components[] = $plugintype . '_' . $pluginname;
-            }
-        }
-        // Get all subsystems.
-        foreach (\core_component::get_core_subsystems() as $name => $path) {
-            if (isset($path)) {
-                $components[] = 'core_' . $name;
-            }
-        }
-        return $components;
+        return array_keys(array_reduce(\core_component::get_component_list(), function($carry, $item) {
+            return array_merge($carry, $item);
+        }, []));
     }
 
     /**