Merge branch 'w29_MDL-40220_m26_core_component' of https://github.com/skodak/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2013-07-17 01:07:21 +02:00
commit 0b3af0798c
110 changed files with 244 additions and 240 deletions

View File

@ -47,7 +47,7 @@ $table->set_attribute('class', 'admintable generaltable');
$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 {

View File

@ -95,7 +95,7 @@ class mnet_review_host_form extends moodleform {
$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);

View File

@ -39,7 +39,7 @@ echo $OUTPUT->header();
$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();

View File

@ -163,7 +163,7 @@ if (($action == 'edit') || ($action == 'new')) {
$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();

View File

@ -39,7 +39,7 @@ require_capability('moodle/question:config', $systemcontext);
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.
@ -186,14 +186,14 @@ if (($delete = optional_param('delete', '', PARAM_PLUGIN)) && confirm_sesskey())
}
// Then the tables themselves
drop_plugin_tables($delete, get_plugin_directory('qbehaviour', $delete) . '/db/install.xml', false);
drop_plugin_tables($delete, core_component::get_plugin_directory('qbehaviour', $delete) . '/db/install.xml', false);
// Remove event handlers and dequeue pending events
events_uninstall('qbehaviour_' . $delete);
$a = new stdClass();
$a->behaviour = $behaviourname;
$a->directory = get_plugin_directory('qbehaviour', $delete);
$a->directory = core_component::get_plugin_directory('qbehaviour', $delete);
echo $OUTPUT->box(get_string('qbehaviourdeletefiles', 'question', $a), 'generalbox', 'notice');
echo $OUTPUT->continue_button($thispageurl);
echo $OUTPUT->footer();

View File

@ -49,7 +49,7 @@ $table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthw
$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 {

View File

@ -390,7 +390,7 @@ if (($action == 'edit') || ($action == 'new')) {
}
// 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

View File

@ -24,7 +24,7 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
$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));

View File

@ -178,7 +178,7 @@ if (has_capability('moodle/grade:manage', $systemcontext)
// 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');
@ -191,7 +191,7 @@ if (has_capability('moodle/grade:manage', $systemcontext)
// 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')) {
@ -206,7 +206,7 @@ if (has_capability('moodle/grade:manage', $systemcontext)
// 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');

View File

@ -382,7 +382,7 @@ $ADMIN->add('reports', new admin_externalpage('comments', new lang_string('comme
// 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,
@ -405,7 +405,7 @@ if ($hassiteconfig) {
// 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,
@ -431,7 +431,7 @@ if ($hassiteconfig) {
}
// 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);
@ -444,7 +444,7 @@ if ($hassiteconfig) {
$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');
@ -463,7 +463,7 @@ if ($hassiteconfig) {
// 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);

View File

@ -39,7 +39,7 @@ class tool_customlang_filter_form extends moodleform {
// Component
$options = array();
foreach (tool_customlang_utils::list_components() as $component => $normalized) {
list($type, $plugin) = normalize_component($normalized);
list($type, $plugin) = core_component::normalize_component($normalized);
if ($type == 'core' and is_null($plugin)) {
$plugin = 'moodle';
}

View File

@ -267,7 +267,7 @@ class tool_customlang_utils {
if ($filename !== clean_param($filename, PARAM_FILE)) {
throw new coding_exception('Incorrect file name '.s($filename));
}
list($package, $subpackage) = normalize_component($component);
list($package, $subpackage) = core_component::normalize_component($component);
$packageinfo = " * @package $package";
if (!is_null($subpackage)) {
$packageinfo .= "\n * @subpackage $subpackage";

View File

@ -105,9 +105,9 @@ 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);
$plugs = core_component::get_plugin_list($type);
foreach ($plugs as $plug => $fullplug) {
$component = $type.'_'.$plug;
$DB->delete_records('log_display', array('component'=>$component));

View File

@ -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;
@ -250,7 +250,7 @@ class tool_installaddon_installer {
exit();
}
list($plugintype, $pluginname) = normalize_component($data->component);
list($plugintype, $pluginname) = core_component::normalize_component($data->component);
$plugintypepath = $this->get_plugintype_root($plugintype);

View File

@ -332,7 +332,7 @@ class tool_installaddon_validator {
if (isset($info[$type.'->component'])) {
$this->versionphp['component'] = $info[$type.'->component'];
list($reqtype, $reqname) = normalize_component($this->versionphp['component']);
list($reqtype, $reqname) = core_component::normalize_component($this->versionphp['component']);
if ($reqtype !== $this->assertions['plugintype']) {
$this->add_message(self::ERROR, 'componentmismatchtype', array(
'expected' => $this->assertions['plugintype'],
@ -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;

View File

@ -44,7 +44,7 @@ class tool_qeupgradehelper_extract_options_form extends moodleform {
'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);
}

View File

@ -53,7 +53,7 @@ class tool_uploadcourse_helper_testcase extends advanced_testcase {
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());
}

View File

@ -49,7 +49,7 @@ $table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthw
$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 {

View File

@ -40,7 +40,7 @@ $webservice = optional_param('webservice', '', PARAM_SAFEDIR);
$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);
}

View File

@ -67,7 +67,7 @@ if (!isset($functions[$function])) {
}
// 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) {

View File

@ -84,7 +84,7 @@ abstract class moodle1_handlers_factory {
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";
@ -1335,7 +1335,7 @@ class moodle1_question_bank_handler extends moodle1_xml_handler {
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';

View File

@ -50,7 +50,7 @@ require_once($CFG->dirroot . '/backup/moodle2/backup_stepslib.php');
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)) {
@ -61,7 +61,7 @@ foreach ($mods as $mod => $moddir) {
}
// 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)) {

View File

@ -176,7 +176,7 @@ abstract class backup_qtype_plugin extends backup_plugin {
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) {

View File

@ -121,7 +121,7 @@ abstract class backup_activity_structure_step extends backup_structure_step {
$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';

View File

@ -157,7 +157,7 @@ class backup_xml_transformer extends xml_contenttransformer {
$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';
@ -165,7 +165,7 @@ class backup_xml_transformer extends xml_contenttransformer {
}
// 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';

View File

@ -57,7 +57,7 @@ require_once($CFG->dirroot . '/backup/moodle2/restore_settingslib.php');
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)) {
@ -68,7 +68,7 @@ foreach ($mods as $mod => $moddir) {
}
// 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)) {

View File

@ -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
@ -135,7 +135,7 @@ abstract class restore_plugin {
// (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)) {

View File

@ -918,7 +918,7 @@ class restore_groups_members_structure_step extends restore_structure_step {
}
} else {
$dir = get_component_directory($data->component);
$dir = core_component::get_component_directory($data->component);
if ($dir and is_dir($dir)) {
if (component_callback($data->component, 'restore_group_member', array($this, $data), true)) {
return;
@ -1483,7 +1483,7 @@ class restore_course_structure_step extends restore_structure_step {
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;
@ -1597,7 +1597,7 @@ class restore_ras_and_caps_structure_step extends restore_structure_step {
$data->roleid = $newroleid;
$data->userid = $newuserid;
$data->contextid = $contextid;
$dir = get_component_directory($data->component);
$dir = core_component::get_component_directory($data->component);
if ($dir and is_dir($dir)) {
if (component_callback($data->component, 'restore_role_assignment', array($this, $data), true)) {
return;
@ -3184,7 +3184,7 @@ abstract class restore_activity_structure_step extends restore_structure_step {
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';

View File

@ -72,7 +72,7 @@ abstract class backup_general_helper extends backup_helper {
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

View File

@ -110,7 +110,7 @@ class restore_decode_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';
@ -121,7 +121,7 @@ class restore_decode_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';

View File

@ -110,7 +110,7 @@ class restore_logs_processor {
$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';

View File

@ -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);
}
@ -146,7 +146,7 @@ abstract class backup_structure_step extends backup_step {
$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';

View File

@ -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,12 +298,12 @@ 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);
}
// 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

View File

@ -193,8 +193,8 @@ class block_community_renderer extends plugin_renderer_base {
//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 = '';

10
cache/locallib.php vendored
View File

@ -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) {
@ -954,7 +954,7 @@ abstract class cache_administration_helper extends cache_helper {
*/
public static function get_add_store_form($plugin) {
global $CFG; // Needed for includes.
$plugins = get_plugin_list('cachestore');
$plugins = core_component::get_plugin_list('cachestore');
if (!array_key_exists($plugin, $plugins)) {
throw new coding_exception('Invalid cache plugin used when trying to create an edit form.');
}
@ -986,7 +986,7 @@ abstract class cache_administration_helper extends cache_helper {
*/
public static function get_edit_store_form($plugin, $store) {
global $CFG; // Needed for includes.
$plugins = get_plugin_list('cachestore');
$plugins = core_component::get_plugin_list('cachestore');
if (!array_key_exists($plugin, $plugins)) {
throw new coding_exception('Invalid cache plugin used when trying to create an edit form.');
}
@ -1191,7 +1191,7 @@ abstract class cache_administration_helper extends cache_helper {
* @return array
*/
public static function get_addable_lock_options() {
$plugins = get_plugin_list_with_class('cachelock', '', 'lib.php');
$plugins = core_component::get_plugin_list_with_class('cachelock', '', 'lib.php');
$options = array();
$len = strlen('cachelock_');
foreach ($plugins as $plugin => $class) {
@ -1215,7 +1215,7 @@ abstract class cache_administration_helper extends cache_helper {
*/
public static function get_add_lock_form($plugin, array $lockplugin = null) {
global $CFG; // Needed for includes.
$plugins = get_plugin_list('cachelock');
$plugins = core_component::get_plugin_list('cachelock');
if (!array_key_exists($plugin, $plugins)) {
throw new coding_exception('Invalid cache lock plugin requested when trying to create a form.');
}

View File

@ -260,7 +260,7 @@ class comment {
throw new coding_exception('You cannot change the component of a comment once it has been set');
}
$this->component = $component;
list($this->plugintype, $this->pluginname) = normalize_component($component);
list($this->plugintype, $this->pluginname) = core_component::normalize_component($component);
}
/**

View File

@ -122,7 +122,7 @@ class dndupload_handler {
// Loop through all modules to find handlers.
$mods = get_plugin_list_with_function('mod', 'dndupload_register');
foreach ($mods as $component => $funcname) {
list($modtype, $modname) = normalize_component($component);
list($modtype, $modname) = core_component::normalize_component($component);
if ($modnames && !array_key_exists($modname, $modnames)) {
continue; // Module is deactivated (hidden) at the site level.
}

View File

@ -528,7 +528,7 @@ class core_course_external extends external_api {
$params = self::validate_parameters(self::create_courses_parameters(),
array('courses' => $courses));
$availablethemes = get_plugin_list('theme');
$availablethemes = core_component::get_plugin_list('theme');
$availablelangs = get_string_manager()->get_list_of_translations();
$transaction = $DB->start_delegated_transaction();
@ -692,7 +692,7 @@ class core_course_external extends external_api {
$params = self::validate_parameters(self::update_courses_parameters(),
array('courses' => $courses));
$availablethemes = get_plugin_list('theme');
$availablethemes = core_component::get_plugin_list('theme');
$availablelangs = get_string_manager()->get_list_of_translations();
foreach ($params['courses'] as $course) {

View File

@ -134,7 +134,7 @@ abstract class format_base {
global $CFG;
static $classnames = array('site' => 'format_site');
if (!isset($classnames[$format])) {
$plugins = get_plugin_list('format');
$plugins = core_component::get_plugin_list('format');
$usedformat = self::get_format_or_default($format);
if (file_exists($plugins[$usedformat].'/lib.php')) {
require_once($plugins[$usedformat].'/lib.php');

View File

@ -2985,7 +2985,7 @@ function include_course_ajax($course, $usedmodules = array(), $enabledmodules =
*/
function get_sorted_course_formats($enabledonly = false) {
global $CFG;
$formats = get_plugin_list('format');
$formats = core_component::get_plugin_list('format');
if (!empty($CFG->format_plugins_sortorder)) {
$order = explode(',', $CFG->format_plugins_sortorder);

View File

@ -19,7 +19,7 @@
$PAGE->set_heading($course->fullname.': '.$strreports);
echo $OUTPUT->header();
$reports = get_plugin_list('coursereport');
$reports = core_component::get_plugin_list('coursereport');
foreach ($reports as $report => $reportdirectory) {
$pluginfile = $reportdirectory.'/mod.php';

View File

@ -104,7 +104,7 @@ class course_settings_form extends moodleform {
$types = array('report', 'export', 'import');
foreach($types as $type) {
foreach (get_plugin_list('grade'.$type) as $plugin => $plugindir) {
foreach (core_component::get_plugin_list('grade'.$type) as $plugin => $plugindir) {
// Include all the settings commands for this plugin if there are any
if (file_exists($plugindir.'/lib.php')) {
require_once($plugindir.'/lib.php');

View File

@ -88,7 +88,7 @@ abstract class gradingform_controller {
global $DB;
$this->context = $context;
list($type, $name) = normalize_component($component);
list($type, $name) = core_component::normalize_component($component);
$this->component = $type.'_'.$name;
$this->area = $area;
$this->areaid = $areaid;

View File

@ -139,7 +139,7 @@ class grading_manager {
*/
public function set_component($component) {
$this->areacache = null;
list($type, $name) = normalize_component($component);
list($type, $name) = core_component::normalize_component($component);
$this->component = $type.'_'.$name;
}
@ -253,7 +253,7 @@ class grading_manager {
$list = array();
}
foreach (get_plugin_list('gradingform') as $name => $location) {
foreach (core_component::get_plugin_list('gradingform') as $name => $location) {
$list[$name] = get_string('pluginname', 'gradingform_'.$name);
}
@ -288,7 +288,7 @@ class grading_manager {
public static function available_areas($component) {
global $CFG;
list($plugintype, $pluginname) = normalize_component($component);
list($plugintype, $pluginname) = core_component::normalize_component($component);
if ($component === 'core_grading') {
return array();

View File

@ -2513,7 +2513,7 @@ abstract class grade_helper {
$context = context_course::instance($courseid);
$gradereports = array();
$gradepreferences = array();
foreach (get_plugin_list('gradereport') as $plugin => $plugindir) {
foreach (core_component::get_plugin_list('gradereport') as $plugin => $plugindir) {
//some reports make no sense if we're not within a course
if ($courseid==$SITE->id && ($plugin=='grader' || $plugin=='user')) {
continue;
@ -2679,7 +2679,7 @@ abstract class grade_helper {
$context = context_course::instance($courseid);
if (has_capability('moodle/grade:import', $context)) {
foreach (get_plugin_list('gradeimport') as $plugin => $plugindir) {
foreach (core_component::get_plugin_list('gradeimport') as $plugin => $plugindir) {
if (!has_capability('gradeimport/'.$plugin.':view', $context)) {
continue;
}
@ -2717,7 +2717,7 @@ abstract class grade_helper {
$context = context_course::instance($courseid);
$exportplugins = array();
if (has_capability('moodle/grade:export', $context)) {
foreach (get_plugin_list('gradeexport') as $plugin => $plugindir) {
foreach (core_component::get_plugin_list('gradeexport') as $plugin => $plugindir) {
if (!has_capability('gradeexport/'.$plugin.':view', $context)) {
continue;
}

View File

@ -36,7 +36,7 @@ require_login($course);
$context = context_course::instance($course->id);
/// find all accessible reports
$reports = get_plugin_list('gradereport'); // Get all installed reports
$reports = core_component::get_plugin_list('gradereport'); // Get all installed reports
foreach ($reports as $plugin => $plugindir) { // Remove ones we can't see
if (!has_capability('gradereport/'.$plugin.':view', $context)) {

View File

@ -82,7 +82,7 @@ function groups_add_member($grouporid, $userorid, $component=null, $itemid=0) {
// Check the component exists if specified
if (!empty($component)) {
$dir = get_component_directory($component);
$dir = core_component::get_component_directory($component);
if ($dir && is_dir($dir)) {
// Component exists and can be used
$member->component = $component;

View File

@ -2387,7 +2387,7 @@ function count_enrolled_users(context $context, $withcapability = '', $groupid =
* @return array array of capabilities
*/
function load_capability_def($component) {
$defpath = get_component_directory($component).'/db/access.php';
$defpath = core_component::get_component_directory($component).'/db/access.php';
$capabilities = array();
if (file_exists($defpath)) {
@ -2863,7 +2863,7 @@ function get_capability_string($capabilityname) {
return get_string($stringname, $component);
}
$dir = get_component_directory($component);
$dir = core_component::get_component_directory($component);
if (!file_exists($dir)) {
// plugin broken or does not exist, do not bother with printing of debug message
return $capabilityname.' ???';
@ -2895,8 +2895,8 @@ function get_component_string($component, $contextlevel) {
}
}
list($type, $name) = normalize_component($component);
$dir = get_plugin_directory($type, $name);
list($type, $name) = core_component::normalize_component($component);
$dir = core_component::get_plugin_directory($type, $name);
if (!file_exists($dir)) {
// plugin not installed, bad luck, there is no way to find the name
return $component.' ???';
@ -6863,7 +6863,7 @@ class context_module extends context {
include($subpluginsfile);
if (!empty($subplugins)) {
foreach (array_keys($subplugins) as $subplugintype) {
foreach (array_keys(get_plugin_list($subplugintype)) as $subpluginname) {
foreach (array_keys(core_component::get_plugin_list($subplugintype)) as $subpluginname) {
$subcaps = array_merge($subcaps, array_keys(load_capability_def($subplugintype.'_'.$subpluginname)));
}
}

View File

@ -166,7 +166,7 @@ function uninstall_plugin($type, $name) {
echo $OUTPUT->heading($pluginname);
$plugindirectory = get_plugin_directory($type, $name);
$plugindirectory = core_component::get_plugin_directory($type, $name);
$uninstalllib = $plugindirectory . '/db/uninstall.php';
if (file_exists($uninstalllib)) {
require_once($uninstalllib);
@ -342,7 +342,7 @@ function uninstall_plugin($type, $name) {
function get_component_version($component, $source='installed') {
global $CFG, $DB;
list($type, $name) = normalize_component($component);
list($type, $name) = core_component::normalize_component($component);
// moodle core or a core subsystem
if ($type === 'core') {
@ -368,7 +368,7 @@ function get_component_version($component, $source='installed') {
if ($source === 'installed') {
return $DB->get_field('modules', 'version', array('name'=>$name));
} else {
$mods = get_plugin_list('mod');
$mods = core_component::get_plugin_list('mod');
if (empty($mods[$name]) or !is_readable($mods[$name].'/version.php')) {
return false;
} else {
@ -384,7 +384,7 @@ function get_component_version($component, $source='installed') {
if ($source === 'installed') {
return $DB->get_field('block', 'version', array('name'=>$name));
} else {
$blocks = get_plugin_list('block');
$blocks = core_component::get_plugin_list('block');
if (empty($blocks[$name]) or !is_readable($blocks[$name].'/version.php')) {
return false;
} else {
@ -399,7 +399,7 @@ function get_component_version($component, $source='installed') {
if ($source === 'installed') {
return get_config($type.'_'.$name, 'version');
} else {
$plugins = get_plugin_list($type);
$plugins = core_component::get_plugin_list($type);
if (empty($plugins[$name])) {
return false;
} else {
@ -494,10 +494,10 @@ 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)) {
if ($plugins = core_component::get_plugin_list($plugintype)) {
foreach ($plugins as $plugin => $plugindir) {
$dbdirs[] = $plugindir.'/db';
}
@ -4732,7 +4732,7 @@ class admin_setting_special_gradeexport extends admin_setting_configmulticheckbo
}
$this->choices = array();
if ($plugins = get_plugin_list('gradeexport')) {
if ($plugins = core_component::get_plugin_list('gradeexport')) {
foreach($plugins as $plugin => $unused) {
$this->choices[$plugin] = get_string('pluginname', 'gradeexport_'.$plugin);
}
@ -4902,7 +4902,7 @@ class admin_setting_grade_profilereport extends admin_setting_configselect {
global $CFG;
require_once($CFG->libdir.'/gradelib.php');
foreach (get_plugin_list('gradereport') as $plugin => $plugindir) {
foreach (core_component::get_plugin_list('gradereport') as $plugin => $plugindir) {
if (file_exists($plugindir.'/lib.php')) {
require_once($plugindir.'/lib.php');
$functionname = 'grade_report_'.$plugin.'_profilereport';
@ -5411,7 +5411,7 @@ class admin_page_manageqbehaviours extends admin_externalpage {
$found = false;
require_once($CFG->dirroot . '/question/engine/lib.php');
foreach (get_plugin_list('qbehaviour') as $behaviour => $notused) {
foreach (core_component::get_plugin_list('qbehaviour') as $behaviour => $notused) {
if (strpos(textlib::strtolower(question_engine::get_behaviour_name($behaviour)),
$query) !== false) {
$found = true;
@ -5499,7 +5499,7 @@ class admin_page_manageportfolios extends admin_externalpage {
}
$found = false;
$portfolios = get_plugin_list('portfolio');
$portfolios = core_component::get_plugin_list('portfolio');
foreach ($portfolios as $p => $dir) {
if (strpos($p, $query) !== false) {
$found = true;
@ -5550,7 +5550,7 @@ class admin_page_managerepositories extends admin_externalpage {
}
$found = false;
$repositories= get_plugin_list('repository');
$repositories= core_component::get_plugin_list('repository');
foreach ($repositories as $p => $dir) {
if (strpos($p, $query) !== false) {
$found = true;
@ -5632,7 +5632,7 @@ class admin_setting_manageauths extends admin_setting {
return true;
}
$authsavailable = get_plugin_list('auth');
$authsavailable = core_component::get_plugin_list('auth');
foreach ($authsavailable as $auth => $dir) {
if (strpos($auth, $query) !== false) {
return true;
@ -5663,7 +5663,7 @@ class admin_setting_manageauths extends admin_setting {
'up', 'down', 'none'));
$txt->updown = "$txt->up/$txt->down";
$authsavailable = get_plugin_list('auth');
$authsavailable = core_component::get_plugin_list('auth');
get_enabled_auth_plugins(true); // fix the list of enabled auths
if (empty($CFG->auth)) {
$authsenabled = array();
@ -6782,7 +6782,7 @@ function db_replace($search, $replace) {
rebuild_course_cache(0, true);
// TODO: we should ask all plugins to do the search&replace, for now let's do only blocks...
$blocks = get_plugin_list('block');
$blocks = core_component::get_plugin_list('block');
foreach ($blocks as $blockname=>$fullblock) {
if ($blockname === 'NEWBLOCK') { // Someone has unzipped the template, ignore it
continue;
@ -6875,7 +6875,7 @@ class admin_setting_managerepository extends admin_setting {
return true;
}
$repositories= get_plugin_list('repository');
$repositories= core_component::get_plugin_list('repository');
foreach ($repositories as $p => $dir) {
if (strpos($p, $query) !== false) {
return true;
@ -7040,7 +7040,7 @@ class admin_setting_managerepository extends admin_setting {
}
// 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
@ -7784,7 +7784,7 @@ class admin_setting_managewebserviceprotocols extends admin_setting {
return true;
}
$protocols = get_plugin_list('webservice');
$protocols = core_component::get_plugin_list('webservice');
foreach ($protocols as $protocol=>$location) {
if (strpos($protocol, $query) !== false) {
return true;
@ -7816,7 +7816,7 @@ class admin_setting_managewebserviceprotocols extends admin_setting {
$strdisable = get_string('disable');
$strversion = get_string('version');
$protocols_available = get_plugin_list('webservice');
$protocols_available = core_component::get_plugin_list('webservice');
$active_protocols = empty($CFG->webserviceprotocols) ? array() : explode(',', $CFG->webserviceprotocols);
ksort($protocols_available);

View File

@ -443,7 +443,7 @@ function cron_run() {
// and finally run any local cronjobs, if any
if ($locals = get_plugin_list('local')) {
if ($locals = core_component::get_plugin_list('local')) {
mtrace('Processing customized cron scripts ...', '');
// new cron functions in lib.php first
cron_execute_plugin_type('local');
@ -532,7 +532,7 @@ function cron_execute_plugin_type($plugintype, $description = null) {
}
foreach ($plugins as $component=>$cronfunction) {
$dir = get_component_directory($component);
$dir = core_component::get_component_directory($component);
// Get cron period if specified in version.php, otherwise assume every cron
$cronperiod = 0;
@ -589,7 +589,7 @@ function cron_bc_hack_plugin_functions($plugintype, $plugins) {
if ($plugintype === 'report') {
// Admin reports only - not course report because course report was
// never implemented before, so doesn't need BC
foreach (get_plugin_list($plugintype) as $pluginname=>$dir) {
foreach (core_component::get_plugin_list($plugintype) as $pluginname=>$dir) {
$component = $plugintype . '_' . $pluginname;
if (isset($plugins[$component])) {
// We already have detected the function using the new API
@ -612,7 +612,7 @@ function cron_bc_hack_plugin_functions($plugintype, $plugins) {
// Detect old style cron function names
// Plugin gradeexport_frog used to use grade_export_frog_cron() instead of
// new standard API gradeexport_frog_cron(). Also applies to gradeimport, gradereport
foreach(get_plugin_list($plugintype) as $pluginname=>$dir) {
foreach(core_component::get_plugin_list($plugintype) as $pluginname=>$dir) {
$component = $plugintype.'_'.$pluginname;
if (isset($plugins[$component])) {
// We already have detected the function using the new API

View File

@ -135,7 +135,7 @@ class tiynce_subplugins_settings extends admin_setting {
return true;
}
$subplugins = get_plugin_list('tinymce');
$subplugins = core_component::get_plugin_list('tinymce');
foreach ($subplugins as $name=>$dir) {
if (stripos($name, $query) !== false) {
return true;
@ -173,7 +173,7 @@ class tiynce_subplugins_settings extends admin_setting {
$struninstall = get_string('uninstallplugin', 'core_admin');
$strversion = get_string('version');
$subplugins = get_plugin_list('tinymce');
$subplugins = core_component::get_plugin_list('tinymce');
$return = $OUTPUT->heading(get_string('subplugintype_tinymce_plural', 'editor_tinymce'), 3, 'main', true);
$return .= $OUTPUT->box_start('generalbox tinymcesubplugins');

View File

@ -68,7 +68,7 @@ foreach ($string as $key=>$value) {
}
// Add subplugin strings, accept only those with proper pluginname prefix with colon.
foreach (get_plugin_list('tinymce') as $component => $ignored) {
foreach (core_component::get_plugin_list('tinymce') as $component => $ignored) {
$componentstrings = get_string_manager()->load_component_strings(
'tinymce_' . $component, $lang);
foreach ($componentstrings as $key => $value) {

View File

@ -378,7 +378,7 @@ abstract class editor_tinymce_plugin {
global $CFG;
// Get list of plugin directories.
$plugins = get_plugin_list('tinymce');
$plugins = core_component::get_plugin_list('tinymce');
// Get list of disabled subplugins.
$disabled = array();
@ -418,7 +418,7 @@ abstract class editor_tinymce_plugin {
* @return editor_tinymce_plugin Plugin object
*/
public static function get($plugin) {
$dir = get_component_directory('tinymce_' . $plugin);
$dir = core_component::get_component_directory('tinymce_' . $plugin);
require_once($dir . '/lib.php');
$classname = 'tinymce_' . $plugin;
return new $classname($plugin);

View File

@ -158,7 +158,7 @@ function get_texteditor($editorname) {
*/
function editors_get_available() {
$editors = array();
foreach (get_plugin_list('editor') as $editorname => $dir) {
foreach (core_component::get_plugin_list('editor') as $editorname => $dir) {
$editors[$editorname] = get_string('pluginname', 'editor_'.$editorname);
}
return $editors;

View File

@ -86,7 +86,7 @@ function enrol_get_plugins($enabled) {
}
} else {
// sorted alphabetically
$plugins = get_plugin_list('enrol');
$plugins = core_component::get_plugin_list('enrol');
ksort($plugins);
}

View File

@ -40,7 +40,7 @@ function events_load_def($component) {
if ($component === 'unittest') {
$defpath = $CFG->dirroot.'/lib/tests/fixtures/events.php';
} else {
$defpath = get_component_directory($component).'/db/events.php';
$defpath = core_component::get_component_directory($component).'/db/events.php';
}
$handlers = array();

View File

@ -44,7 +44,7 @@ function external_function_info($function, $strictness=MUST_EXIST) {
}
//first find and include the ext implementation class
$function->classpath = empty($function->classpath) ? get_component_directory($function->component).'/externallib.php' : $CFG->dirroot.'/'.$function->classpath;
$function->classpath = empty($function->classpath) ? core_component::get_component_directory($function->component).'/externallib.php' : $CFG->dirroot.'/'.$function->classpath;
if (!file_exists($function->classpath)) {
throw new coding_exception('Can not find file with external function implementation');
}
@ -83,7 +83,7 @@ function external_function_info($function, $strictness=MUST_EXIST) {
// on the other hand this is still a bit in a flux and we need to find some new naming
// conventions for these descriptions in lang packs
$function->description = null;
$servicesfile = get_component_directory($function->component).'/db/services.php';
$servicesfile = core_component::get_component_directory($function->component).'/db/services.php';
if (file_exists($servicesfile)) {
$functions = null;
include($servicesfile);

View File

@ -4543,7 +4543,7 @@ function file_pluginfile($relativepath, $forcedownload, $preview = null) {
} else {
// try to serve general plugin file in arbitrary context
$dir = get_component_directory($component);
$dir = core_component::get_component_directory($component);
if (!file_exists("$dir/lib.php")) {
send_file_not_found();
}

View File

@ -513,7 +513,7 @@ function filter_get_all_installed() {
global $CFG;
$filternames = array();
foreach (get_plugin_list('filter') as $filter => $fulldir) {
foreach (core_component::get_plugin_list('filter') as $filter => $fulldir) {
if (is_readable("$fulldir/filter.php")) {
$filternames[$filter] = filter_get_name($filter);
}

View File

@ -2094,7 +2094,7 @@ class grade_item extends grade_object {
* @return bool
*/
public function can_control_visibility() {
if (get_plugin_directory($this->itemtype, $this->itemmodule)) {
if (core_component::get_plugin_directory($this->itemtype, $this->itemmodule)) {
return !plugin_supports($this->itemtype, $this->itemmodule, FEATURE_CONTROLS_GRADE_VISIBILITY, false);
}
return true;

View File

@ -1138,7 +1138,7 @@ function grade_grab_course_grades($courseid, $modname=null, $userid=0) {
return;
}
if (!$mods = get_plugin_list('mod') ) {
if (!$mods = core_component::get_plugin_list('mod') ) {
print_error('nomodules', 'debug');
}

View File

@ -116,7 +116,7 @@ function message_send($eventdata) {
if (PHPUNIT_TEST and class_exists('phpunit_util')) {
// Add some more tests to make sure the normal code can actually work.
$componentdir = get_component_directory($eventdata->component);
$componentdir = core_component::get_component_directory($eventdata->component);
if (!$componentdir or !is_dir($componentdir)) {
throw new coding_exception('Invalid component specified in message-send(): '.$eventdata->component);
}
@ -414,7 +414,7 @@ function message_get_providers_for_user($userid) {
// If the component is an enrolment plugin, check it is enabled
foreach ($providers as $providerid => $provider) {
list($type, $name) = normalize_component($provider->component);
list($type, $name) = core_component::normalize_component($provider->component);
if ($type == 'enrol' && !enrol_is_enabled($name)) {
unset($providers[$providerid]);
}
@ -525,7 +525,7 @@ function message_get_providers_from_db($component) {
* @return array An array of message providers or empty array if not exists
*/
function message_get_providers_from_file($component) {
$defpath = get_component_directory($component).'/db/messages.php';
$defpath = core_component::get_component_directory($component).'/db/messages.php';
$messageproviders = array();

View File

@ -8215,7 +8215,7 @@ function get_plugin_list_with_function($plugintype, $function, $file = 'lib.php'
* Lists plugin-like directories within specified directory
*
* This function was originally used for standard Moodle plugins, please use
* new get_plugin_list() now.
* new core_component::get_plugin_list() now.
*
* This function is used for general directory listing and backwards compatility.
*

View File

@ -2222,7 +2222,7 @@ class global_navigation extends navigation_node {
} else if ($course->id == $SITE->id && has_capability('moodle/user:viewdetails', $usercontext) && (!in_array('mycourses', $hiddenfields) || has_capability('moodle/user:viewhiddendetails', $coursecontext))) {
// Add view grade report is permitted
$reports = get_plugin_list('gradereport');
$reports = core_component::get_plugin_list('gradereport');
arsort($reports); // user is last, we want to test it first
$userscourses = enrol_get_users_courses($user->id);
@ -3572,7 +3572,7 @@ class settings_navigation extends navigation_node {
if (has_capability('moodle/site:viewreports', $coursecontext)) { // Basic capability for listing of reports.
$reportnav = $coursenode->add(get_string('reports'), null, self::TYPE_CONTAINER, null, null,
new pix_icon('i/stats', ''));
$coursereports = get_plugin_list('coursereport');
$coursereports = core_component::get_plugin_list('coursereport');
foreach ($coursereports as $report => $dir) {
$libfile = $CFG->dirroot.'/course/report/'.$report.'/lib.php';
if (file_exists($libfile)) {
@ -3595,7 +3595,7 @@ class settings_navigation extends navigation_node {
if (has_capability('moodle/grade:viewall', $coursecontext)) {
$reportavailable = true;
} else if (!empty($course->showgrades)) {
$reports = get_plugin_list('gradereport');
$reports = core_component::get_plugin_list('gradereport');
if (is_array($reports) && count($reports)>0) { // Get all installed reports
arsort($reports); // user is last, we want to test it first
foreach ($reports as $plugin => $plugindir) {
@ -4297,7 +4297,7 @@ class settings_navigation extends navigation_node {
if (has_capability('moodle/site:viewreports', $coursecontext)) { // Basic capability for listing of reports.
$frontpagenav = $frontpage->add(get_string('reports'), null, self::TYPE_CONTAINER, null, null,
new pix_icon('i/stats', ''));
$coursereports = get_plugin_list('coursereport');
$coursereports = core_component::get_plugin_list('coursereport');
foreach ($coursereports as $report=>$dir) {
$libfile = $CFG->dirroot.'/course/report/'.$report.'/lib.php';
if (file_exists($libfile)) {

View File

@ -165,7 +165,7 @@ abstract class renderer_factory_base implements renderer_factory {
global $CFG; // needed in included files
// standardize component name ala frankenstyle
list($plugin, $type) = normalize_component($component);
list($plugin, $type) = core_component::normalize_component($component);
if ($type === null) {
$component = $plugin;
} else {
@ -174,7 +174,7 @@ abstract class renderer_factory_base implements renderer_factory {
if ($component !== 'core') {
// renderers are stored in renderer.php files
if (!$compdirectory = get_component_directory($component)) {
if (!$compdirectory = core_component::get_component_directory($component)) {
throw new coding_exception('Invalid component specified in renderer request');
}
$rendererfile = $compdirectory . '/renderer.php';

View File

@ -609,7 +609,7 @@ class theme_config {
$files = array();
// first editor plugins
$plugins = get_plugin_list('editor');
$plugins = core_component::get_plugin_list('editor');
foreach ($plugins as $plugin=>$fulldir) {
$sheetfile = "$fulldir/editor_styles.css";
if (is_readable($sheetfile)) {
@ -774,11 +774,11 @@ 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;
}
$plugins = get_plugin_list($type);
$plugins = core_component::get_plugin_list($type);
foreach ($plugins as $plugin=>$fulldir) {
if (!empty($excludes[$type]) and is_array($excludes[$type])
and in_array($plugin, $excludes[$type])) {
@ -1228,7 +1228,7 @@ class theme_config {
if ($imagefile = $this->image_exists("$CFG->dataroot/pix_plugins/$type/$plugin/$image", $svg)) {
return $imagefile;
}
$dir = get_plugin_directory($type, $plugin);
$dir = core_component::get_plugin_directory($type, $plugin);
if ($imagefile = $this->image_exists("$dir/pix/$image", $svg)) {
return $imagefile;
}

View File

@ -416,7 +416,7 @@ class page_requirements_manager {
return true;
}
$componentdir = get_component_directory($component);
$componentdir = core_component::get_component_directory($component);
if (!file_exists($componentdir) or !file_exists("$componentdir/jquery/plugins.php")) {
debugging("Can not load jQuery plugin '$plugin', missing plugins.php in component '$component'.", DEBUG_DEVELOPER);
return false;
@ -709,7 +709,7 @@ class page_requirements_manager {
}
} else {
if ($dir = get_component_directory($component)) {
if ($dir = core_component::get_component_directory($component)) {
if (file_exists("$dir/module.js")) {
if (strpos($dir, $CFG->dirroot.'/') === 0) {
$dir = substr($dir, strlen($CFG->dirroot));
@ -1652,7 +1652,7 @@ class YUI_config {
private function get_moodle_metadata() {
$moodlemodules = array();
// Core isn't a plugin type or subsystem - handle it seperately.
if ($module = $this->get_moodle_path_metadata(get_component_directory('core'))) {
if ($module = $this->get_moodle_path_metadata(core_component::get_component_directory('core'))) {
$moodlemodules = array_merge($moodlemodules, $module);
}
@ -1670,7 +1670,7 @@ class YUI_config {
// And finally the plugins.
$plugintypes = core_component::get_plugin_types();
foreach ($plugintypes as $plugintype => $pathroot) {
$pluginlist = get_plugin_list($plugintype);
$pluginlist = core_component::get_plugin_list($plugintype);
foreach ($pluginlist as $plugin => $path) {
if ($module = $this->get_moodle_path_metadata($path)) {
$moodlemodules = array_merge($moodlemodules, $module);

View File

@ -456,10 +456,10 @@ 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);
$plugs = core_component::get_plugin_list($type);
ksort($plugs);
foreach ($plugs as $plug=>$fullplug) {
if (!file_exists("$fullplug/tests/")) {

View File

@ -188,7 +188,7 @@ function plagiarism_load_available_plugins() {
if (empty($CFG->enableplagiarism)) {
return array();
}
$plagiarismplugins = get_plugin_list('plagiarism');
$plagiarismplugins = core_component::get_plugin_list('plagiarism');
$availableplugins = array();
foreach($plagiarismplugins as $plugin => $dir) {
//check this plugin is enabled and a lib file exists.

View File

@ -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));
}
/**
@ -868,7 +868,7 @@ class plugin_manager {
}
/**
* Wrapper for the core function {@link normalize_component()}.
* Wrapper for the core function {@link core_component::normalize_component()}.
*
* This is here just to make it possible to mock it in unit tests.
*
@ -876,13 +876,13 @@ class plugin_manager {
* @return array
*/
protected function normalize_component($component) {
return normalize_component($component);
return core_component::normalize_component($component);
}
/**
* 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
@ -1619,7 +1619,7 @@ class available_update_checker {
// is a real update with higher version. That is, the $componentchange
// is present in the array of {@link available_update_info} objects
// returned by the plugin's available_updates() method.
list($plugintype, $pluginname) = normalize_component($component);
list($plugintype, $pluginname) = core_component::normalize_component($component);
if (!empty($plugins[$plugintype][$pluginname])) {
$availableupdates = $plugins[$plugintype][$pluginname]->available_updates();
if (!empty($availableupdates)) {
@ -1973,8 +1973,8 @@ class available_update_deployer {
*/
public function plugin_external_source(available_update_info $info) {
$paths = get_plugin_types(true);
list($plugintype, $pluginname) = normalize_component($info->component);
$paths = core_component::get_plugin_types();
list($plugintype, $pluginname) = core_component::normalize_component($info->component);
$pluginroot = $paths[$plugintype].'/'.$pluginname;
if (is_dir($pluginroot.'/.git')) {
@ -2031,9 +2031,9 @@ 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);
list($plugintype, $pluginname) = core_component::normalize_component($info->component);
if (empty($pluginrootpaths[$plugintype])) {
throw new coding_exception('Unknown plugin type root location', $plugintype);
@ -2302,9 +2302,9 @@ class available_update_deployer {
*/
protected function component_writable($component) {
list($plugintype, $pluginname) = normalize_component($component);
list($plugintype, $pluginname) = core_component::normalize_component($component);
$directory = get_plugin_directory($plugintype, $pluginname);
$directory = core_component::get_plugin_directory($plugintype, $pluginname);
if (is_null($directory)) {
throw new coding_exception('Unknown component location', $component);
@ -2460,7 +2460,7 @@ abstract class plugininfo_base {
public static function get_plugins($type, $typerootdir, $typeclass) {
// get the information about plugins at the disk
$plugins = get_plugin_list($type);
$plugins = core_component::get_plugin_list($type);
$ondisk = array();
foreach ($plugins as $pluginname => $pluginrootdir) {
$ondisk[$pluginname] = plugininfo_default_factory::make($type, $typerootdir,

View File

@ -815,7 +815,7 @@ function portfolio_plugin_sanity_check($plugins=null) {
if (is_string($plugins)) {
$plugins = array($plugins);
} else if (empty($plugins)) {
$plugins = get_plugin_list('portfolio');
$plugins = core_component::get_plugin_list('portfolio');
$plugins = array_keys($plugins);
}
@ -1313,7 +1313,7 @@ function portfolio_include_callback_file($component, $class = null) {
}
// Obtain the component's location.
if (!$componentloc = get_component_directory($component)) {
if (!$componentloc = core_component::get_component_directory($component)) {
throw new portfolio_button_exception('nocallbackcomponent', 'portfolio', '', $component);
}

View File

@ -138,7 +138,7 @@ function questions_in_use($questionids) {
return true;
}
foreach (get_plugin_list('mod') as $module => $path) {
foreach (core_component::get_plugin_list('mod') as $module => $path) {
$lib = $path . '/lib.php';
if (is_readable($lib)) {
include_once($lib);
@ -1232,7 +1232,7 @@ function get_import_export_formats($type) {
global $CFG;
require_once($CFG->dirroot . '/question/format.php');
$formatclasses = get_plugin_list_with_class('qformat', '', 'format.php');
$formatclasses = core_component::get_plugin_list_with_class('qformat', '', 'format.php');
$fileformatname = array();
foreach ($formatclasses as $component => $formatclass) {
@ -1880,7 +1880,7 @@ function question_pluginfile($course, $context, $component, $filearea, $args, $f
$component, $filearea, $qubaid, $slot, $args, $forcedownload, $options);
} else {
$dir = get_component_directory($module);
$dir = core_component::get_component_directory($module);
if (!file_exists("$dir/lib.php")) {
send_file_not_found();
}

View File

@ -63,10 +63,10 @@ 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);
$plugs = core_component::get_plugin_list($type);
ksort($plugs);
foreach ($plugs as $plug => $fullplug) {
// Look for tests recursively

View File

@ -690,7 +690,7 @@ abstract class testing_util {
$versions['core'] = $version;
// modules
$mods = get_plugin_list('mod');
$mods = core_component::get_plugin_list('mod');
ksort($mods);
foreach ($mods as $mod => $fullmod) {
$module = new stdClass();
@ -700,11 +700,11 @@ 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) {
$plugs = get_plugin_list($type);
$plugs = core_component::get_plugin_list($type);
ksort($plugs);
foreach ($plugs as $plug => $fullplug) {
$plugin = new stdClass();

View File

@ -95,7 +95,7 @@ EOD;
* @return component_generator_base or rather an instance of the appropriate subclass.
*/
public function get_plugin_generator($component) {
list($type, $plugin) = normalize_component($component);
list($type, $plugin) = core_component::normalize_component($component);
$cleancomponent = $type . '_' . $plugin;
if ($cleancomponent != $component) {
debugging("Please specify the component you want a generator for as " .
@ -107,7 +107,7 @@ EOD;
return $this->generators[$component];
}
$dir = get_component_directory($component);
$dir = core_component::get_component_directory($component);
$lib = $dir . '/tests/generator/lib.php';
if (!$dir || !is_readable($lib)) {
throw new coding_exception("Component {$component} does not support " .

View File

@ -3,7 +3,11 @@ information provided here is intended especially for developers.
=== 2.6 ===
* Use new core_component::* plugin listing and component normalisation methods.
* Use new methods from core_component class instead of get_core_subsystems(), get_plugin_types(),
get_plugin_list(), get_plugin_list_with_class(), get_plugin_directory(), normalize_component()
and get_component_directory(). The names of the new methods are exactly the same, the only differences
are that core_component::get_plugin_types() now always returns full paths and
core_component::get_plugin_list() does not accept empty parameter any more.
* Use core_text::* instead of textlib:: and also core_collator::* instead of collatorlib::*.
* Use new function moodleform::mock_submit() to simulate form submission in unit tests (backported).

View File

@ -385,7 +385,7 @@ function upgrade_plugins($type, $startcallback, $endcallback, $verbose) {
return upgrade_plugins_blocks($startcallback, $endcallback, $verbose);
}
$plugs = get_plugin_list($type);
$plugs = core_component::get_plugin_list($type);
foreach ($plugs as $plug=>$fullplug) {
// Reset time so that it works when installing a large number of plugins
@ -413,7 +413,7 @@ function upgrade_plugins($type, $startcallback, $endcallback, $verbose) {
if (isset($plugin->component)) {
if ($plugin->component !== $component) {
$current = str_replace($CFG->dirroot, '$CFG->dirroot', $fullplug);
$expected = str_replace($CFG->dirroot, '$CFG->dirroot', get_component_directory($plugin->component));
$expected = str_replace($CFG->dirroot, '$CFG->dirroot', core_component::get_component_directory($plugin->component));
throw new plugin_misplaced_exception($component, $expected, $current);
}
}
@ -540,7 +540,7 @@ function upgrade_plugins($type, $startcallback, $endcallback, $verbose) {
function upgrade_plugins_modules($startcallback, $endcallback, $verbose) {
global $CFG, $DB;
$mods = get_plugin_list('mod');
$mods = core_component::get_plugin_list('mod');
foreach ($mods as $mod=>$fullmod) {
@ -571,7 +571,7 @@ function upgrade_plugins_modules($startcallback, $endcallback, $verbose) {
if (isset($module->component)) {
if ($module->component !== $component) {
$current = str_replace($CFG->dirroot, '$CFG->dirroot', $fullmod);
$expected = str_replace($CFG->dirroot, '$CFG->dirroot', get_component_directory($module->component));
$expected = str_replace($CFG->dirroot, '$CFG->dirroot', core_component::get_component_directory($module->component));
throw new plugin_misplaced_exception($component, $expected, $current);
}
}
@ -715,7 +715,7 @@ function upgrade_plugins_blocks($startcallback, $endcallback, $verbose) {
//Is this a first install
$first_install = null;
$blocks = get_plugin_list('block');
$blocks = core_component::get_plugin_list('block');
foreach ($blocks as $blockname=>$fullblock) {
@ -751,7 +751,7 @@ function upgrade_plugins_blocks($startcallback, $endcallback, $verbose) {
if (isset($block->component)) {
if ($block->component !== $component) {
$current = str_replace($CFG->dirroot, '$CFG->dirroot', $fullblock);
$expected = str_replace($CFG->dirroot, '$CFG->dirroot', get_component_directory($block->component));
$expected = str_replace($CFG->dirroot, '$CFG->dirroot', core_component::get_component_directory($block->component));
throw new plugin_misplaced_exception($component, $expected, $current);
}
}
@ -909,7 +909,7 @@ function upgrade_plugins_blocks($startcallback, $endcallback, $verbose) {
function log_update_descriptions($component) {
global $DB;
$defpath = get_component_directory($component).'/db/log.php';
$defpath = core_component::get_component_directory($component).'/db/log.php';
if (!file_exists($defpath)) {
$DB->delete_records('log_display', array('component'=>$component));
@ -966,7 +966,7 @@ function log_update_descriptions($component) {
function external_update_descriptions($component) {
global $DB, $CFG;
$defpath = get_component_directory($component).'/db/services.php';
$defpath = core_component::get_component_directory($component).'/db/services.php';
if (!file_exists($defpath)) {
require_once($CFG->dirroot.'/lib/externallib.php');
@ -1164,7 +1164,7 @@ function upgrade_log($type, $plugin, $info, $details=null, $backtrace=null) {
$plugin = 'core';
}
list($plugintype, $pluginname) = normalize_component($plugin);
list($plugintype, $pluginname) = core_component::normalize_component($plugin);
$component = is_null($pluginname) ? $plugintype : $plugintype . '_' . $pluginname;
$backtrace = format_backtrace($backtrace, true);
@ -1187,7 +1187,7 @@ function upgrade_log($type, $plugin, $info, $details=null, $backtrace=null) {
$currentversion = ($currentversion === false) ? null : $currentversion;
} catch (Exception $ignored) {
}
$cd = get_component_directory($component);
$cd = core_component::get_component_directory($component);
if (file_exists("$cd/version.php")) {
$module = new stdClass();
$module->version = null;
@ -1202,7 +1202,7 @@ function upgrade_log($type, $plugin, $info, $details=null, $backtrace=null) {
}
} catch (Exception $ignored) {
}
$cd = get_component_directory($component);
$cd = core_component::get_component_directory($component);
if (file_exists("$cd/version.php")) {
$plugin = new stdClass();
$plugin->version = null;
@ -1215,7 +1215,7 @@ function upgrade_log($type, $plugin, $info, $details=null, $backtrace=null) {
if (!empty($pluginversion)) {
$currentversion = $pluginversion;
}
$cd = get_component_directory($component);
$cd = core_component::get_component_directory($component);
if (file_exists("$cd/version.php")) {
$plugin = new stdClass();
$plugin->version = null;
@ -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);
}
@ -1629,7 +1629,7 @@ function upgrade_plugin_mnet_functions($component) {
global $DB, $CFG;
list($type, $plugin) = explode('_', $component);
$path = get_plugin_directory($type, $plugin);
$path = core_component::get_plugin_directory($type, $plugin);
$publishes = array();
$subscribes = array();

View File

@ -590,7 +590,7 @@ function mnet_setup_dummy_method($method, $callstack, $rpcrecord) {
$remoteclient = get_mnet_remote_client();
// verify that the callpath in the stack matches our records
// callstack will look like array('mod', 'forum', 'lib.php', 'forum_add_instance');
$path = get_plugin_directory($rpcrecord->plugintype, $rpcrecord->pluginname);
$path = core_component::get_plugin_directory($rpcrecord->plugintype, $rpcrecord->pluginname);
$path = substr($path, strlen($CFG->dirroot)+1); // this is a bit hacky and fragile, it is not guaranteed that plugins are in dirroot
array_pop($callstack);
$providedpath = implode('/', $callstack);

View File

@ -65,7 +65,7 @@ class assign_admin_page_manage_assign_plugins extends admin_externalpage {
$found = false;
$textlib = new textlib();
foreach (get_plugin_list($this->subtype) as $name => $notused) {
foreach (core_component::get_plugin_list($this->subtype) as $name => $notused) {
if (strpos($textlib::strtolower(get_string('pluginname', $this->subtype . '_' . $name)),
$query) !== false) {
$found = true;
@ -116,7 +116,7 @@ class assign_plugin_manager {
* @return array The list of plugins
*/
public function get_sorted_plugins_list() {
$names = get_plugin_list($this->subtype);
$names = core_component::get_plugin_list($this->subtype);
$result = array();

View File

@ -75,7 +75,7 @@ abstract class assign_plugin {
* @return bool
*/
public final function is_last() {
$lastindex = count(get_plugin_list($this->get_subtype()))-1;
$lastindex = count(core_component::get_plugin_list($this->get_subtype()))-1;
$currentindex = get_config($this->get_subtype() . '_' . $this->get_type(), 'sortorder');
if ($lastindex == $currentindex) {
return true;

View File

@ -858,7 +858,7 @@ function assign_cron() {
require_once($CFG->dirroot . '/mod/assign/locallib.php');
assign::cron();
$plugins = get_plugin_list('assignsubmission');
$plugins = core_component::get_plugin_list('assignsubmission');
foreach ($plugins as $name => $plugin) {
$disabled = get_config('assignsubmission_' . $name, 'disabled');
@ -868,7 +868,7 @@ function assign_cron() {
$class::cron();
}
}
$plugins = get_plugin_list('assignfeedback');
$plugins = core_component::get_plugin_list('assignfeedback');
foreach ($plugins as $name => $plugin) {
$disabled = get_config('assignfeedback_' . $name, 'disabled');

View File

@ -331,7 +331,7 @@ class assign {
global $CFG;
$result = array();
$names = get_plugin_list($subtype);
$names = core_component::get_plugin_list($subtype);
foreach ($names as $name => $path) {
if (file_exists($path . '/locallib.php')) {

View File

@ -40,7 +40,7 @@ assign_plugin_manager::add_admin_assign_plugin_settings('assignfeedback', $ADMIN
if ($ADMIN->fulltree) {
$menu = array();
foreach (get_plugin_list('assignfeedback') as $type => $notused) {
foreach (core_component::get_plugin_list('assignfeedback') as $type => $notused) {
$visible = !get_config('assignfeedback_' . $type, 'disabled');
if ($visible) {
$menu['assignfeedback_' . $type] = new lang_string('pluginname', 'assignfeedback_' . $type);

View File

@ -54,7 +54,7 @@ class mod_assign_locallib_testcase extends mod_assign_base_testcase {
public function test_get_feedback_plugins() {
$this->setUser($this->editingteachers[0]);
$assign = $this->create_instance();
$installedplugins = array_keys(get_plugin_list('assignfeedback'));
$installedplugins = array_keys(core_component::get_plugin_list('assignfeedback'));
foreach ($assign->get_feedback_plugins() as $plugin) {
$this->assertContains($plugin->get_type(), $installedplugins, 'Feedback plugin not in list of installed plugins');
@ -64,7 +64,7 @@ class mod_assign_locallib_testcase extends mod_assign_base_testcase {
public function test_get_submission_plugins() {
$this->setUser($this->editingteachers[0]);
$assign = $this->create_instance();
$installedplugins = array_keys(get_plugin_list('assignsubmission'));
$installedplugins = array_keys(core_component::get_plugin_list('assignsubmission'));
foreach ($assign->get_submission_plugins() as $plugin) {
$this->assertContains($plugin->get_type(), $installedplugins, 'Submission plugin not in list of installed plugins');

View File

@ -173,7 +173,7 @@ class moodle1_mod_assignment_handler extends moodle1_mod_handler {
if (is_null($this->subpluginhandlers)) {
$this->subpluginhandlers = array();
$subplugins = get_plugin_list('assignment');
$subplugins = core_component::get_plugin_list('assignment');
foreach ($subplugins as $name => $dir) {
$handlerfile = $dir.'/backup/moodle1/lib.php';
$handlerclass = "moodle1_mod_assignment_{$name}_subplugin_handler";

View File

@ -2825,7 +2825,7 @@ function assignment_cron () {
global $CFG, $USER, $DB;
/// first execute all crons in plugins
if ($plugins = get_plugin_list('assignment')) {
if ($plugins = core_component::get_plugin_list('assignment')) {
foreach ($plugins as $plugin=>$dir) {
require_once("$dir/assignment.class.php");
$assignmentclass = "assignment_$plugin";
@ -3637,7 +3637,7 @@ function assignment_get_coursemodule_info($coursemodule) {
*/
function assignment_types() {
$types = array();
$names = get_plugin_list('assignment');
$names = core_component::get_plugin_list('assignment');
foreach ($names as $name=>$dir) {
$types[$name] = get_string('type'.$name, 'assignment');
@ -3820,7 +3820,7 @@ function assignment_get_types() {
}
/// Drop-in extra assignment types
$assignmenttypes = get_plugin_list('assignment');
$assignmenttypes = core_component::get_plugin_list('assignment');
foreach ($assignmenttypes as $assignmenttype=>$fulldir) {
if (!empty($CFG->{'assignment_hide_'.$assignmenttype})) { // Not wanted
continue;
@ -3880,7 +3880,7 @@ function assignment_reset_userdata($data) {
global $CFG;
$status = array();
foreach (get_plugin_list('assignment') as $type=>$dir) {
foreach (core_component::get_plugin_list('assignment') as $type=>$dir) {
require_once("$dir/assignment.class.php");
$assignmentclass = "assignment_$type";
$ass = new $assignmentclass();

View File

@ -229,7 +229,7 @@ function book_get_view_actions() {
$return = array('view', 'view all');
$plugins = get_plugin_list('booktool');
$plugins = core_component::get_plugin_list('booktool');
foreach ($plugins as $plugin => $dir) {
if (file_exists("$dir/lib.php")) {
require_once("$dir/lib.php");
@ -254,7 +254,7 @@ function book_get_post_actions() {
$return = array('update');
$plugins = get_plugin_list('booktool');
$plugins = core_component::get_plugin_list('booktool');
foreach ($plugins as $plugin => $dir) {
if (file_exists("$dir/lib.php")) {
require_once("$dir/lib.php");
@ -303,7 +303,7 @@ function book_supports($feature) {
function book_extend_settings_navigation(settings_navigation $settingsnav, navigation_node $booknode) {
global $USER, $PAGE;
$plugins = get_plugin_list('booktool');
$plugins = core_component::get_plugin_list('booktool');
foreach ($plugins as $plugin => $dir) {
if (file_exists("$dir/lib.php")) {
require_once("$dir/lib.php");

View File

@ -240,7 +240,7 @@ switch ($mode) {
/// Print the browsing interface
///get the list of possible fields (plugins)
$plugins = get_plugin_list('datafield');
$plugins = core_component::get_plugin_list('datafield');
$menufield = array();
foreach ($plugins as $plugin=>$fulldir){

View File

@ -1877,7 +1877,7 @@ function data_get_available_presets($context) {
$presets = array();
// First load the ratings sub plugins that exist within the modules preset dir
if ($dirs = get_plugin_list('datapreset')) {
if ($dirs = core_component::get_plugin_list('datapreset')) {
foreach ($dirs as $dir=>$fulldir) {
if (is_directory_a_preset($fulldir)) {
$preset = new stdClass();

View File

@ -803,7 +803,7 @@ function lesson_extend_settings_navigation($settings, $lessonnode) {
*/
function lesson_get_import_export_formats($type) {
global $CFG;
$fileformats = get_plugin_list("qformat");
$fileformats = core_component::get_plugin_list("qformat");
$fileformatname=array();
foreach ($fileformats as $fileformat=>$fdir) {

View File

@ -90,7 +90,7 @@ class quiz_access_manager {
* @return array of all the installed rule class names.
*/
protected static function get_rule_classes() {
return get_plugin_list_with_class('quizaccess', '', 'rule.php');
return core_component::get_plugin_list_with_class('quizaccess', '', 'rule.php');
}
/**

View File

@ -113,7 +113,7 @@ function xmldb_quiz_upgrade($oldversion) {
// Get a list of response variables that have files.
require_once($CFG->dirroot . '/question/type/questiontypebase.php');
$variables = array();
foreach (get_plugin_list('qtype') as $qtypename => $path) {
foreach (core_component::get_plugin_list('qtype') as $qtypename => $path) {
$file = $path . '/questiontype.php';
if (!is_readable($file)) {
continue;

View File

@ -331,7 +331,7 @@ function quiz_report_list($context) {
}
$reports = $DB->get_records('quiz_reports', null, 'displayorder DESC', 'name, capability');
$reportdirs = get_plugin_list('quiz');
$reportdirs = core_component::get_plugin_list('quiz');
// Order the reports tab in descending order of displayorder.
$reportcaps = array();

View File

@ -35,7 +35,7 @@ function scorm_report_list($context) {
if (!empty($reportlist)) {
return $reportlist;
}
$installed = get_plugin_list('scormreport');
$installed = core_component::get_plugin_list('scormreport');
foreach ($installed as $reportname => $notused) {
$pluginfile = $CFG->dirroot.'/mod/scorm/report/'.$reportname.'/report.php';
if (is_readable($pluginfile)) {

View File

@ -268,7 +268,7 @@ class moodle1_mod_workshop_handler extends moodle1_mod_handler {
if (is_null($this->strategyhandlers)) {
$this->strategyhandlers = array();
$subplugins = get_plugin_list('workshopform');
$subplugins = core_component::get_plugin_list('workshopform');
foreach ($subplugins as $name => $dir) {
$handlerfile = $dir.'/backup/moodle1/lib.php';
$handlerclass = "moodle1_workshopform_{$name}_handler";

View File

@ -211,21 +211,21 @@ function workshop_delete_instance($id) {
$DB->delete_records_list('workshop_submissions', 'id', array_keys($submissions));
// call the static clean-up methods of all available subplugins
$strategies = get_plugin_list('workshopform');
$strategies = core_component::get_plugin_list('workshopform');
foreach ($strategies as $strategy => $path) {
require_once($path.'/lib.php');
$classname = 'workshop_'.$strategy.'_strategy';
call_user_func($classname.'::delete_instance', $workshop->id);
}
$allocators = get_plugin_list('workshopallocation');
$allocators = core_component::get_plugin_list('workshopallocation');
foreach ($allocators as $allocator => $path) {
require_once($path.'/lib.php');
$classname = 'workshop_'.$allocator.'_allocator';
call_user_func($classname.'::delete_instance', $workshop->id);
}
$evaluators = get_plugin_list('workshopeval');
$evaluators = core_component::get_plugin_list('workshopeval');
foreach ($evaluators as $evaluator => $path) {
require_once($path.'/lib.php');
$classname = 'workshop_'.$evaluator.'_evaluation';
@ -974,7 +974,7 @@ function workshop_cron() {
function workshop_scale_used($workshopid, $scaleid) {
global $CFG; // other files included from here
$strategies = get_plugin_list('workshopform');
$strategies = core_component::get_plugin_list('workshopform');
foreach ($strategies as $strategy => $strategypath) {
$strategylib = $strategypath . '/lib.php';
if (is_readable($strategylib)) {
@ -1007,7 +1007,7 @@ function workshop_scale_used($workshopid, $scaleid) {
function workshop_scale_used_anywhere($scaleid) {
global $CFG; // other files included from here
$strategies = get_plugin_list('workshopform');
$strategies = core_component::get_plugin_list('workshopform');
foreach ($strategies as $strategy => $strategypath) {
$strategylib = $strategypath . '/lib.php';
if (is_readable($strategylib)) {

View File

@ -212,7 +212,7 @@ class workshop {
* @return array Array ['string' => 'string'] of localized allocation method names
*/
public static function installed_allocators() {
$installed = get_plugin_list('workshopallocation');
$installed = core_component::get_plugin_list('workshopallocation');
$forms = array();
foreach ($installed as $allocation => $allocationpath) {
if (file_exists($allocationpath . '/lib.php')) {
@ -287,7 +287,7 @@ class workshop {
* @return array ['string' => 'string']
*/
public static function available_strategies_list() {
$installed = get_plugin_list('workshopform');
$installed = core_component::get_plugin_list('workshopform');
$forms = array();
foreach ($installed as $strategy => $strategypath) {
if (file_exists($strategypath . '/lib.php')) {

View File

@ -61,7 +61,7 @@ if ($ADMIN->fulltree) {
get_string('configexamplesmode', 'workshop'), workshop::EXAMPLES_VOLUNTARY, $options));
// include the settings of allocation subplugins
$allocators = get_plugin_list('workshopallocation');
$allocators = core_component::get_plugin_list('workshopallocation');
foreach ($allocators as $allocator => $path) {
if (file_exists($settingsfile = $path . '/settings.php')) {
$settings->add(new admin_setting_heading('workshopallocationsetting'.$allocator,
@ -71,7 +71,7 @@ if ($ADMIN->fulltree) {
}
// include the settings of grading strategy subplugins
$strategies = get_plugin_list('workshopform');
$strategies = core_component::get_plugin_list('workshopform');
foreach ($strategies as $strategy => $path) {
if (file_exists($settingsfile = $path . '/settings.php')) {
$settings->add(new admin_setting_heading('workshopformsetting'.$strategy,
@ -81,7 +81,7 @@ if ($ADMIN->fulltree) {
}
// include the settings of grading evaluation subplugins
$evaluations = get_plugin_list('workshopeval');
$evaluations = core_component::get_plugin_list('workshopeval');
foreach ($evaluations as $evaluation => $path) {
if (file_exists($settingsfile = $path . '/settings.php')) {
$settings->add(new admin_setting_heading('workshopevalsetting'.$evaluation,

View File

@ -73,7 +73,7 @@ abstract class question_bank {
* @return bool whether that question type is installed in this Moodle.
*/
public static function is_qtype_installed($qtypename) {
$plugindir = get_plugin_directory('qtype', $qtypename);
$plugindir = core_component::get_plugin_directory('qtype', $qtypename);
return $plugindir && is_readable($plugindir . '/questiontype.php');
}
@ -89,7 +89,7 @@ abstract class question_bank {
if (isset(self::$questiontypes[$qtypename])) {
return self::$questiontypes[$qtypename];
}
$file = get_plugin_directory('qtype', $qtypename) . '/questiontype.php';
$file = core_component::get_plugin_directory('qtype', $qtypename) . '/questiontype.php';
if (!is_readable($file)) {
if ($mustexist || $qtypename == 'missingtype') {
throw new coding_exception('Unknown question type ' . $qtypename);
@ -133,7 +133,7 @@ abstract class question_bank {
* @return bool whether this question type exists.
*/
public static function qtype_exists($qtypename) {
return array_key_exists($qtypename, get_plugin_list('qtype'));
return array_key_exists($qtypename, core_component::get_plugin_list('qtype'));
}
/**
@ -149,7 +149,7 @@ abstract class question_bank {
*/
public static function get_all_qtypes() {
$qtypes = array();
foreach (get_plugin_list('qtype') as $plugin => $notused) {
foreach (core_component::get_plugin_list('qtype') as $plugin => $notused) {
try {
$qtypes[$plugin] = self::get_qtype($plugin);
} catch (coding_exception $e) {

View File

@ -225,7 +225,7 @@ abstract class question_engine {
*/
public static function get_archetypal_behaviours() {
$archetypes = array();
$behaviours = get_plugin_list('qbehaviour');
$behaviours = core_component::get_plugin_list('qbehaviour');
foreach ($behaviours as $behaviour => $notused) {
if (self::is_behaviour_archetypal($behaviour)) {
$archetypes[$behaviour] = self::get_behaviour_name($behaviour);

Some files were not shown because too many files have changed in this diff Show More