Skip to content

Commit

Permalink
MDL-40220 use new core_component::get_plugin_list()
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Jul 16, 2013
1 parent 46f6f7f commit bd3b3bb
Show file tree
Hide file tree
Showing 87 changed files with 147 additions and 147 deletions.
2 changes: 1 addition & 1 deletion admin/localplugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
$table->setup();

$plugins = array();
foreach (get_plugin_list('local') as $plugin => $plugindir) {
foreach (core_component::get_plugin_list('local') as $plugin => $plugindir) {
if (get_string_manager()->string_exists('pluginname', 'local_' . $plugin)) {
$strpluginname = get_string('pluginname', 'local_' . $plugin);
} else {
Expand Down
2 changes: 1 addition & 1 deletion admin/mnet/peer_forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function definition() {
$mform->addRule('wwwroot', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');

$themes = array('' => get_string('forceno'));
foreach (array_keys(get_plugin_list('theme')) as $themename) {
foreach (array_keys(core_component::get_plugin_list('theme')) as $themename) {
$themes[$themename] = get_string('pluginname', 'theme_'.$themename);
}
$mform->addElement('select', 'theme', get_string('forcetheme'), $themes);
Expand Down
2 changes: 1 addition & 1 deletion admin/plagiarism.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
$txt = get_strings(array('settings', 'name', 'version'));
$txt->uninstall = get_string('uninstallplugin', 'core_admin');

$plagiarismplugins = get_plugin_list('plagiarism');
$plagiarismplugins = core_component::get_plugin_list('plagiarism');
if (empty($plagiarismplugins)) {
echo $OUTPUT->notification(get_string('nopluginsinstalled', 'plagiarism'));
echo $OUTPUT->footer();
Expand Down
2 changes: 1 addition & 1 deletion admin/portfolio.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ function portfolio_action_url($portfolio) {

$output = $OUTPUT->box_start('generalbox');

$plugins = get_plugin_list('portfolio');
$plugins = core_component::get_plugin_list('portfolio');
$plugins = array_keys($plugins);
$instances = portfolio_instances(false, false);
$usedplugins = array();
Expand Down
2 changes: 1 addition & 1 deletion admin/qbehaviours.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
admin_externalpage_setup('manageqbehaviours');
$thispageurl = new moodle_url('/admin/qbehaviours.php');

$behaviours = get_plugin_list('qbehaviour');
$behaviours = core_component::get_plugin_list('qbehaviour');
$pluginmanager = plugin_manager::instance();

// Get some data we will need - question counts and which types are needed.
Expand Down
2 changes: 1 addition & 1 deletion admin/reports.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
$table->setup();

$plugins = array();
foreach (get_plugin_list('report') as $plugin => $plugindir) {
foreach (core_component::get_plugin_list('report') as $plugin => $plugindir) {
if (get_string_manager()->string_exists('pluginname', 'report_' . $plugin)) {
$strpluginname = get_string('pluginname', 'report_' . $plugin);
} else {
Expand Down
2 changes: 1 addition & 1 deletion admin/repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ function repository_action_url($repository) {
}

// Get all the plugins that exist on disk
$plugins = get_plugin_list('repository');
$plugins = core_component::get_plugin_list('repository');
if (!empty($plugins)) {
foreach ($plugins as $plugin => $dir) {
// Check that it has not already been listed
Expand Down
2 changes: 1 addition & 1 deletion admin/settings/appearance.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
$ADMIN->add('themes', new admin_externalpage('themeselector', new lang_string('themeselector','admin'), $CFG->wwwroot . '/theme/index.php'));

// settings for each theme
foreach (get_plugin_list('theme') as $theme => $themedir) {
foreach (core_component::get_plugin_list('theme') as $theme => $themedir) {
$settings_path = "$themedir/settings.php";
if (file_exists($settings_path)) {
$settings = new admin_settingpage('themesetting'.$theme, new lang_string('pluginname', 'theme_'.$theme));
Expand Down
6 changes: 3 additions & 3 deletions admin/settings/grades.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@

// Reports
$ADMIN->add('grades', new admin_category('gradereports', new lang_string('reportsettings', 'grades')));
foreach (get_plugin_list('gradereport') as $plugin => $plugindir) {
foreach (core_component::get_plugin_list('gradereport') as $plugin => $plugindir) {
// Include all the settings commands for this plugin if there are any
if (file_exists($plugindir.'/settings.php')) {
$settings = new admin_settingpage('gradereport'.$plugin, new lang_string('pluginname', 'gradereport_'.$plugin), 'moodle/grade:manage');
Expand All @@ -191,7 +191,7 @@

// Imports
$ADMIN->add('grades', new admin_category('gradeimports', new lang_string('importsettings', 'grades')));
foreach (get_plugin_list('gradeimport') as $plugin => $plugindir) {
foreach (core_component::get_plugin_list('gradeimport') as $plugin => $plugindir) {

// Include all the settings commands for this plugin if there are any
if (file_exists($plugindir.'/settings.php')) {
Expand All @@ -206,7 +206,7 @@

// Exports
$ADMIN->add('grades', new admin_category('gradeexports', new lang_string('exportsettings', 'grades')));
foreach (get_plugin_list('gradeexport') as $plugin => $plugindir) {
foreach (core_component::get_plugin_list('gradeexport') as $plugin => $plugindir) {
// Include all the settings commands for this plugin if there are any
if (file_exists($plugindir.'/settings.php')) {
$settings = new admin_settingpage('gradeexport'.$plugin, new lang_string('pluginname', 'gradeexport_'.$plugin), 'moodle/grade:manage');
Expand Down
10 changes: 5 additions & 5 deletions admin/settings/plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@
// Course reports settings
if ($hassiteconfig) {
$pages = array();
foreach (get_plugin_list('coursereport') as $report => $path) {
foreach (core_component::get_plugin_list('coursereport') as $report => $path) {
$file = $CFG->dirroot . '/course/report/' . $report . '/settings.php';
if (file_exists($file)) {
$settings = new admin_settingpage('coursereport' . $report,
Expand All @@ -405,7 +405,7 @@

// Now add reports
$pages = array();
foreach (get_plugin_list('report') as $report => $plugindir) {
foreach (core_component::get_plugin_list('report') as $report => $plugindir) {
$settings_path = "$plugindir/settings.php";
if (file_exists($settings_path)) {
$settings = new admin_settingpage('report' . $report,
Expand All @@ -431,7 +431,7 @@
}

// Now add various admin tools
foreach (get_plugin_list('tool') as $plugin => $plugindir) {
foreach (core_component::get_plugin_list('tool') as $plugin => $plugindir) {
$settings_path = "$plugindir/settings.php";
if (file_exists($settings_path)) {
include($settings_path);
Expand All @@ -444,7 +444,7 @@
$ADMIN->add('cache', new admin_externalpage('cacheconfig', new lang_string('cacheconfig', 'cache'), $CFG->wwwroot .'/cache/admin.php'));
$ADMIN->add('cache', new admin_externalpage('cachetestperformance', new lang_string('testperformance', 'cache'), $CFG->wwwroot . '/cache/testperformance.php'));
$ADMIN->add('cache', new admin_category('cachestores', new lang_string('cachestores', 'cache')));
foreach (get_plugin_list('cachestore') as $plugin => $path) {
foreach (core_component::get_plugin_list('cachestore') as $plugin => $path) {
$settingspath = $path.'/settings.php';
if (file_exists($settingspath)) {
$settings = new admin_settingpage('cachestore_'.$plugin.'_settings', new lang_string('pluginname', 'cachestore_'.$plugin), 'moodle/site:config');
Expand All @@ -463,7 +463,7 @@

// extend settings for each local plugin. Note that their settings may be in any part of the
// settings tree and may be visible not only for administrators. We can not use $allplugins here
foreach (get_plugin_list('local') as $plugin => $plugindir) {
foreach (core_component::get_plugin_list('local') as $plugin => $plugindir) {
$settings_path = "$plugindir/settings.php";
if (file_exists($settings_path)) {
include($settings_path);
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/dbtransfer/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function tool_dbtransfer_rebuild_target_log_actions(moodle_database $target, pro
log_update_descriptions('moodle');
$plugintypes = core_component::get_plugin_types();
foreach ($plugintypes as $type => $location) {
$plugs = get_plugin_list($type);
$plugs = core_component::get_plugin_list($type);
foreach ($plugs as $plug => $fullplug) {
$component = $type.'_'.$plug;
$DB->delete_records('log_display', array('component'=>$component));
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/qeupgradehelper/extracttestcase_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function definition() {
'adaptivenopenalty' => 'Adaptive (no penalties)',
);

$qtypes = get_plugin_list('qtype');
$qtypes = core_component::get_plugin_list('qtype');
foreach ($qtypes as $qtype => $notused) {
$qtypes[$qtype] = get_string($qtype, 'qtype_' . $qtype);
}
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/uploadcourse/tests/helper_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function test_generate_shortname() {

public function test_get_course_formats() {
$result = tool_uploadcourse_helper::get_course_formats();
$this->assertSame(array_keys(get_plugin_list('format')), $result);
$this->assertSame(array_keys(core_component::get_plugin_list('format')), $result);
// Should be similar as first result, as cached.
$this->assertSame($result, tool_uploadcourse_helper::get_course_formats());
}
Expand Down
2 changes: 1 addition & 1 deletion admin/tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
$table->setup();

$plugins = array();
foreach (get_plugin_list('tool') as $plugin => $plugindir) {
foreach (core_component::get_plugin_list('tool') as $plugin => $plugindir) {
if (get_string_manager()->string_exists('pluginname', 'tool_' . $plugin)) {
$strpluginname = get_string('pluginname', 'tool_' . $plugin);
} else {
Expand Down
2 changes: 1 addition & 1 deletion admin/webservice/protocols.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
$confirm = optional_param('confirm', 0, PARAM_BOOL);

// get currently installed and enabled auth plugins
$available_webservices = get_plugin_list('webservice');
$available_webservices = core_component::get_plugin_list('webservice');
if (!empty($webservice) and empty($available_webservices[$webservice])) {
redirect($returnurl);
}
Expand Down
2 changes: 1 addition & 1 deletion admin/webservice/testclient.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
}

// list all enabled webservices
$available_protocols = get_plugin_list('webservice');
$available_protocols = core_component::get_plugin_list('webservice');
$active_protocols = empty($CFG->webserviceprotocols) ? array() : explode(',', $CFG->webserviceprotocols);
$protocols = array();
foreach ($active_protocols as $p) {
Expand Down
4 changes: 2 additions & 2 deletions backup/converter/moodle1/handlerlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ protected static function get_plugin_handlers($type, moodle1_converter $converte
global $CFG;

$handlers = array();
$plugins = get_plugin_list($type);
$plugins = core_component::get_plugin_list($type);
foreach ($plugins as $name => $dir) {
$handlerfile = $dir . '/backup/moodle1/lib.php';
$handlerclass = "moodle1_{$type}_{$name}_handler";
Expand Down Expand Up @@ -1335,7 +1335,7 @@ protected function get_qtype_handler($qtype) {
if (is_null($this->qtypehandlers)) {
// initialize the list of qtype handler instances
$this->qtypehandlers = array();
foreach (get_plugin_list('qtype') as $qtypename => $qtypelocation) {
foreach (core_component::get_plugin_list('qtype') as $qtypename => $qtypelocation) {
$filename = $qtypelocation.'/backup/moodle1/lib.php';
if (file_exists($filename)) {
$classname = 'moodle1_qtype_'.$qtypename.'_handler';
Expand Down
4 changes: 2 additions & 2 deletions backup/moodle2/backup_plan_builder.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
require_once($CFG->dirroot . '/backup/moodle2/backup_custom_fields.php');

// Load all the activity tasks for moodle2 format
$mods = get_plugin_list('mod');
$mods = core_component::get_plugin_list('mod');
foreach ($mods as $mod => $moddir) {
$taskpath = $moddir . '/backup/moodle2/backup_' . $mod . '_activity_task.class.php';
if (plugin_supports('mod', $mod, FEATURE_BACKUP_MOODLE2)) {
Expand All @@ -61,7 +61,7 @@
}

// Load all the block tasks for moodle2 format
$blocks = get_plugin_list('block');
$blocks = core_component::get_plugin_list('block');
foreach ($blocks as $block => $blockdir) {
$taskpath = $blockdir . '/backup/moodle2/backup_' . $block . '_block_task.class.php';
if (file_exists($taskpath)) {
Expand Down
2 changes: 1 addition & 1 deletion backup/moodle2/backup_qtype_plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ protected function add_question_datasets($element) {
public static function get_components_and_fileareas($filter = null) {
$components = array();
// Get all the plugins of this type
$qtypes = get_plugin_list('qtype');
$qtypes = core_component::get_plugin_list('qtype');
foreach ($qtypes as $name => $path) {
// Apply filter if specified
if (!is_null($filter) && $filter != $name) {
Expand Down
2 changes: 1 addition & 1 deletion backup/moodle2/backup_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ protected function add_subplugin_structure($subplugintype, $element, $multiple)
$element->add_child($optigroup); // Add optigroup to stay connected since beginning

// Get all the optigroup_elements, looking across all the subplugin dirs
$subpluginsdirs = get_plugin_list($subplugintype);
$subpluginsdirs = core_component::get_plugin_list($subplugintype);
foreach ($subpluginsdirs as $name => $subpluginsdir) {
$classname = 'backup_' . $subplugintype . '_' . $name . '_subplugin';
$backupfile = $subpluginsdir . '/backup/moodle2/' . $classname . '.class.php';
Expand Down
4 changes: 2 additions & 2 deletions backup/moodle2/backup_xml_transformer.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,15 @@ private function register_link_encoders() {
$encoders['backup_course_task'] = 'encode_content_links';

// Add the module ones. Each module supporting moodle2 backups MUST have it
$mods = get_plugin_list('mod');
$mods = core_component::get_plugin_list('mod');
foreach ($mods as $mod => $moddir) {
if (plugin_supports('mod', $mod, FEATURE_BACKUP_MOODLE2)) {
$encoders['backup_' . $mod . '_activity_task'] = 'encode_content_links';
}
}

// Add the block encoders
$blocks = get_plugin_list('block');
$blocks = core_component::get_plugin_list('block');
foreach ($blocks as $block => $blockdir) {
if (class_exists('backup_' . $block . '_block_task')) {
$encoders['backup_' . $block . '_block_task'] = 'encode_content_links';
Expand Down
4 changes: 2 additions & 2 deletions backup/moodle2/restore_plan_builder.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
require_once($CFG->dirroot . '/backup/moodle2/restore_stepslib.php');

// Load all the activity tasks for moodle2 format
$mods = get_plugin_list('mod');
$mods = core_component::get_plugin_list('mod');
foreach ($mods as $mod => $moddir) {
$taskpath = $moddir . '/backup/moodle2/restore_' . $mod . '_activity_task.class.php';
if (plugin_supports('mod', $mod, FEATURE_BACKUP_MOODLE2)) {
Expand All @@ -68,7 +68,7 @@
}

// Load all the block tasks for moodle2 format
$blocks = get_plugin_list('block');
$blocks = core_component::get_plugin_list('block');
foreach ($blocks as $block => $blockdir) {
$taskpath = $blockdir . '/backup/moodle2/restore_' . $block . '_block_task.class.php';
if (file_exists($taskpath)) {
Expand Down
2 changes: 1 addition & 1 deletion backup/moodle2/restore_plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ static public function get_restore_decode_contents($plugintype) {
// (only the needed ones have been loaded, so they will
// be the ones being asked here). Fetch their restore contents
// by calling (if exists) to their define_decode_contents() method
$plugins = get_plugin_list($plugintype);
$plugins = core_component::get_plugin_list($plugintype);
foreach ($plugins as $plugin => $plugindir) {
$classname = 'restore_' . $plugintype . '_' . $plugin . '_plugin';
if (class_exists($classname)) {
Expand Down
4 changes: 2 additions & 2 deletions backup/moodle2/restore_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1483,7 +1483,7 @@ protected function after_execute() {
unset($roleids[$roleid]);
}

foreach (get_plugin_list('mod') as $modname => $notused) {
foreach (core_component::get_plugin_list('mod') as $modname => $notused) {
if (isset($this->legacyallowedmodules[$modname])) {
// Module is allowed, no worries.
continue;
Expand Down Expand Up @@ -3184,7 +3184,7 @@ protected function add_subplugin_structure($subplugintype, $element) {
throw new restore_step_exception('incorrect_subplugin_type', $subplugintype);
}
// Get all the restore path elements, looking across all the subplugin dirs
$subpluginsdirs = get_plugin_list($subplugintype);
$subpluginsdirs = core_component::get_plugin_list($subplugintype);
foreach ($subpluginsdirs as $name => $subpluginsdir) {
$classname = 'restore_' . $subplugintype . '_' . $name . '_subplugin';
$restorefile = $subpluginsdir . '/backup/moodle2/' . $classname . '.class.php';
Expand Down
2 changes: 1 addition & 1 deletion backup/util/helper/backup_general_helper.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static function get_blocks_from_path($path) {

static $availableblocks = array(); // Get and cache available blocks
if (empty($availableblocks)) {
$availableblocks = array_keys(get_plugin_list('block'));
$availableblocks = array_keys(core_component::get_plugin_list('block'));
}

$path = $path . '/blocks'; // Always look under blocks subdir
Expand Down
4 changes: 2 additions & 2 deletions backup/util/helper/restore_decode_processor.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public static function register_link_decoders($processor) {
$tasks[] = 'restore_section_task';

// Add the module tasks
$mods = get_plugin_list('mod');
$mods = core_component::get_plugin_list('mod');
foreach ($mods as $mod => $moddir) {
if (class_exists('restore_' . $mod . '_activity_task')) {
$tasks[] = 'restore_' . $mod . '_activity_task';
Expand All @@ -121,7 +121,7 @@ public static function register_link_decoders($processor) {
$tasks[] = 'restore_default_block_task';

// Add the custom block tasks
$blocks = get_plugin_list('block');
$blocks = core_component::get_plugin_list('block');
foreach ($blocks as $block => $blockdir) {
if (class_exists('restore_' . $block . '_block_task')) {
$tasks[] = 'restore_' . $block . '_block_task';
Expand Down
2 changes: 1 addition & 1 deletion backup/util/helper/restore_logs_processor.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public static function register_log_rules_for_course() {
$rules = array(); // To accumulate rules for course

// Add the module tasks
$mods = get_plugin_list('mod');
$mods = core_component::get_plugin_list('mod');
foreach ($mods as $mod => $moddir) {
if (class_exists('restore_' . $mod . '_activity_task')) {
$tasks[$mod] = 'restore_' . $mod . '_activity_task';
Expand Down
2 changes: 1 addition & 1 deletion backup/util/plan/backup_structure_step.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ protected function add_plugin_structure($plugintype, $element, $multiple) {
$element->add_child($optigroup); // Add optigroup to stay connected since beginning

// Get all the optigroup_elements, looking across all the plugin dirs
$pluginsdirs = get_plugin_list($plugintype);
$pluginsdirs = core_component::get_plugin_list($plugintype);
foreach ($pluginsdirs as $name => $plugindir) {
$classname = 'backup_' . $plugintype . '_' . $name . '_plugin';
$backupfile = $plugindir . '/backup/moodle2/' . $classname . '.class.php';
Expand Down
2 changes: 1 addition & 1 deletion backup/util/plan/restore_structure_step.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ protected function add_plugin_structure($plugintype, $element) {
}

// Get all the restore path elements, looking across all the plugin dirs
$pluginsdirs = get_plugin_list($plugintype);
$pluginsdirs = core_component::get_plugin_list($plugintype);
foreach ($pluginsdirs as $name => $pluginsdir) {
// We need to add also backup plugin classes on restore, they may contain
// some stuff used both in backup & restore
Expand Down
4 changes: 2 additions & 2 deletions blocks/community/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ public function course_list($courses, $huburl, $contextcourseid) {


//Create course content html
$blocks = get_plugin_list('block');
$activities = get_plugin_list('mod');
$blocks = core_component::get_plugin_list('block');
$activities = core_component::get_plugin_list('mod');
if (!empty($course->contents)) {
$activitieshtml = '';
$blockhtml = '';
Expand Down
Loading

0 comments on commit bd3b3bb

Please sign in to comment.