From 46f6f7f224edbd850fff3631e9705c03f7927426 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20S=CC=8Ckoda?= Date: Tue, 16 Jul 2013 22:31:48 +0200 Subject: [PATCH] MDL-40220 use new core_component::get_plugin_types() --- admin/tool/dbtransfer/locallib.php | 2 +- admin/tool/installaddon/classes/installer.php | 2 +- admin/tool/installaddon/classes/validator.php | 2 +- backup/moodle2/restore_plugin.class.php | 2 +- backup/util/plan/backup_structure_step.class.php | 4 ++-- backup/util/plan/restore_structure_step.class.php | 4 ++-- cache/locallib.php | 2 +- lib/adminlib.php | 4 ++-- lib/outputlib.php | 2 +- lib/phpunit/classes/util.php | 2 +- lib/pluginlib.php | 10 +++++----- lib/testing/classes/tests_finder.php | 2 +- lib/testing/classes/util.php | 2 +- lib/upgradelib.php | 2 +- 14 files changed, 21 insertions(+), 21 deletions(-) diff --git a/admin/tool/dbtransfer/locallib.php b/admin/tool/dbtransfer/locallib.php index 8b0b0622f54..192081860d8 100644 --- a/admin/tool/dbtransfer/locallib.php +++ b/admin/tool/dbtransfer/locallib.php @@ -105,7 +105,7 @@ function tool_dbtransfer_rebuild_target_log_actions(moodle_database $target, pro try { $DB->delete_records('log_display', array('component'=>'moodle')); log_update_descriptions('moodle'); - $plugintypes = get_plugin_types(); + $plugintypes = core_component::get_plugin_types(); foreach ($plugintypes as $type => $location) { $plugs = get_plugin_list($type); foreach ($plugs as $plug => $fullplug) { diff --git a/admin/tool/installaddon/classes/installer.php b/admin/tool/installaddon/classes/installer.php index 0b888ba1a29..d3affb98af6 100644 --- a/admin/tool/installaddon/classes/installer.php +++ b/admin/tool/installaddon/classes/installer.php @@ -182,7 +182,7 @@ class tool_installaddon_installer { public function get_plugintype_root($plugintype) { $plugintypepath = null; - foreach (get_plugin_types() as $type => $fullpath) { + foreach (core_component::get_plugin_types() as $type => $fullpath) { if ($type === $plugintype) { $plugintypepath = $fullpath; break; diff --git a/admin/tool/installaddon/classes/validator.php b/admin/tool/installaddon/classes/validator.php index 557fbc1d664..e5865c7ccd3 100644 --- a/admin/tool/installaddon/classes/validator.php +++ b/admin/tool/installaddon/classes/validator.php @@ -563,7 +563,7 @@ class tool_installaddon_validator { $plugintypepath = null; - foreach (get_plugin_types() as $type => $fullpath) { + foreach (core_component::get_plugin_types() as $type => $fullpath) { if ($type === $plugintype) { $plugintypepath = $fullpath; break; diff --git a/backup/moodle2/restore_plugin.class.php b/backup/moodle2/restore_plugin.class.php index d85790b6bd0..de0d446d0a5 100644 --- a/backup/moodle2/restore_plugin.class.php +++ b/backup/moodle2/restore_plugin.class.php @@ -118,7 +118,7 @@ abstract class restore_plugin { static public function get_restore_decode_contents($plugintype) { $decodecontents = array(); // Check the requested plugintype is a valid one - if (!array_key_exists($plugintype, get_plugin_types($plugintype))) { + if (!array_key_exists($plugintype, core_component::get_plugin_types($plugintype))) { throw new backup_step_exception('incorrect_plugin_type', $plugintype); } // Check the base plugin class exists diff --git a/backup/util/plan/backup_structure_step.class.php b/backup/util/plan/backup_structure_step.class.php index 964dd3f9885..aea978c7946 100644 --- a/backup/util/plan/backup_structure_step.class.php +++ b/backup/util/plan/backup_structure_step.class.php @@ -125,7 +125,7 @@ abstract class backup_structure_step extends backup_step { /** * Add plugin structure to any element in the structure backup tree * - * @param string $plugintype type of plugin as defined by get_plugin_types() + * @param string $plugintype type of plugin as defined by core_component::get_plugin_types() * @param backup_nested_element $element element in the structure backup tree that * we are going to add plugin information to * @param bool $multiple to define if multiple plugins can produce information @@ -136,7 +136,7 @@ abstract class backup_structure_step extends backup_step { global $CFG; // Check the requested plugintype is a valid one - if (!array_key_exists($plugintype, get_plugin_types($plugintype))) { + if (!array_key_exists($plugintype, core_component::get_plugin_types($plugintype))) { throw new backup_step_exception('incorrect_plugin_type', $plugintype); } diff --git a/backup/util/plan/restore_structure_step.class.php b/backup/util/plan/restore_structure_step.class.php index da344872f10..1432db1bdbc 100644 --- a/backup/util/plan/restore_structure_step.class.php +++ b/backup/util/plan/restore_structure_step.class.php @@ -289,7 +289,7 @@ abstract class restore_structure_step extends restore_step { /** * Add plugin structure to any element in the structure restore tree * - * @param string $plugintype type of plugin as defined by get_plugin_types() + * @param string $plugintype type of plugin as defined by core_component::get_plugin_types() * @param restore_path_element $element element in the structure restore tree that * we are going to add plugin information to */ @@ -298,7 +298,7 @@ abstract class restore_structure_step extends restore_step { global $CFG; // Check the requested plugintype is a valid one - if (!array_key_exists($plugintype, get_plugin_types($plugintype))) { + if (!array_key_exists($plugintype, core_component::get_plugin_types($plugintype))) { throw new restore_step_exception('incorrect_plugin_type', $plugintype); } diff --git a/cache/locallib.php b/cache/locallib.php index 2e6c0185922..f68d7695f6a 100644 --- a/cache/locallib.php +++ b/cache/locallib.php @@ -520,7 +520,7 @@ class cache_config_writer extends cache_config { } if (!$coreonly) { - $plugintypes = get_plugin_types(); + $plugintypes = core_component::get_plugin_types(); foreach ($plugintypes as $type => $location) { $plugins = get_plugin_list_with_file($type, 'db/caches.php'); foreach ($plugins as $plugin => $filepath) { diff --git a/lib/adminlib.php b/lib/adminlib.php index 5aafeb10ddd..37f7a8772c4 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -494,8 +494,8 @@ function get_db_directories() { /// First, the main one (lib/db) $dbdirs[] = $CFG->libdir.'/db'; - /// Then, all the ones defined by get_plugin_types() - $plugintypes = get_plugin_types(); + /// Then, all the ones defined by core_component::get_plugin_types() + $plugintypes = core_component::get_plugin_types(); foreach ($plugintypes as $plugintype => $pluginbasedir) { if ($plugins = get_plugin_list($plugintype)) { foreach ($plugins as $plugin => $plugindir) { diff --git a/lib/outputlib.php b/lib/outputlib.php index 7afd582459e..26ed10261fe 100644 --- a/lib/outputlib.php +++ b/lib/outputlib.php @@ -774,7 +774,7 @@ class theme_config { // get all plugin sheets $excludes = $this->resolve_excludes('plugins_exclude_sheets'); if ($excludes !== true) { - foreach (get_plugin_types() as $type=>$unused) { + foreach (core_component::get_plugin_types() as $type=>$unused) { if ($type === 'theme' || (!empty($excludes[$type]) and $excludes[$type] === true)) { continue; } diff --git a/lib/phpunit/classes/util.php b/lib/phpunit/classes/util.php index 85cdaed9278..471de07daa4 100644 --- a/lib/phpunit/classes/util.php +++ b/lib/phpunit/classes/util.php @@ -456,7 +456,7 @@ class phpunit_util extends testing_util { $suites = ''; - $plugintypes = get_plugin_types(); + $plugintypes = core_component::get_plugin_types(); ksort($plugintypes); foreach ($plugintypes as $type=>$unused) { $plugs = get_plugin_list($type); diff --git a/lib/pluginlib.php b/lib/pluginlib.php index 2f2b72d4e93..3f598f77ff5 100644 --- a/lib/pluginlib.php +++ b/lib/pluginlib.php @@ -97,14 +97,14 @@ class plugin_manager { } /** - * Returns the result of {@link get_plugin_types()} ordered for humans + * Returns the result of {@link core_component::get_plugin_types()} ordered for humans * * @see self::reorder_plugin_types() * @param bool $fullpaths false means relative paths from dirroot * @return array (string)name => (string)location */ public function get_plugin_types($fullpaths = true) { - return $this->reorder_plugin_types(get_plugin_types($fullpaths)); + return $this->reorder_plugin_types(core_component::get_plugin_types($fullpaths)); } /** @@ -882,7 +882,7 @@ class plugin_manager { /** * Reorders plugin types into a sequence to be displayed * - * For technical reasons, plugin types returned by {@link get_plugin_types()} are + * For technical reasons, plugin types returned by {@link core_component::get_plugin_types()} are * in a certain order that does not need to fit the expected order for the display. * Particularly, activity modules should be displayed first as they represent the * real heart of Moodle. They should be followed by other plugin types that are @@ -1973,7 +1973,7 @@ class available_update_deployer { */ public function plugin_external_source(available_update_info $info) { - $paths = get_plugin_types(true); + $paths = core_component::get_plugin_types(); list($plugintype, $pluginname) = normalize_component($info->component); $pluginroot = $paths[$plugintype].'/'.$pluginname; @@ -2031,7 +2031,7 @@ class available_update_deployer { throw new coding_exception('Illegal method call - deployer not initialized.'); } - $pluginrootpaths = get_plugin_types(true); + $pluginrootpaths = core_component::get_plugin_types(); list($plugintype, $pluginname) = normalize_component($info->component); diff --git a/lib/testing/classes/tests_finder.php b/lib/testing/classes/tests_finder.php index 18f987a1c18..10d98172e02 100644 --- a/lib/testing/classes/tests_finder.php +++ b/lib/testing/classes/tests_finder.php @@ -63,7 +63,7 @@ class tests_finder { private static function get_all_plugins_with_tests($testtype) { $pluginswithtests = array(); - $plugintypes = get_plugin_types(); + $plugintypes = core_component::get_plugin_types(); ksort($plugintypes); foreach ($plugintypes as $type => $unused) { $plugs = get_plugin_list($type); diff --git a/lib/testing/classes/util.php b/lib/testing/classes/util.php index bbd9e1726a4..e51865cb33f 100644 --- a/lib/testing/classes/util.php +++ b/lib/testing/classes/util.php @@ -700,7 +700,7 @@ abstract class testing_util { } // now the rest of plugins - $plugintypes = get_plugin_types(); + $plugintypes = core_component::get_plugin_types(); unset($plugintypes['mod']); ksort($plugintypes); foreach ($plugintypes as $type => $unused) { diff --git a/lib/upgradelib.php b/lib/upgradelib.php index e2b5aa34704..cf4b15c1018 100644 --- a/lib/upgradelib.php +++ b/lib/upgradelib.php @@ -1583,7 +1583,7 @@ function upgrade_noncore($verbose) { // upgrade all plugins types try { - $plugintypes = get_plugin_types(); + $plugintypes = core_component::get_plugin_types(); foreach ($plugintypes as $type=>$location) { upgrade_plugins($type, 'print_upgrade_part_start', 'print_upgrade_part_end', $verbose); }