diff --git a/backup/moodle2/restore_stepslib.php b/backup/moodle2/restore_stepslib.php index 65241c99f61..ed36b0a886e 100644 --- a/backup/moodle2/restore_stepslib.php +++ b/backup/moodle2/restore_stepslib.php @@ -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; @@ -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; diff --git a/group/lib.php b/group/lib.php index b8d13b0733a..86d23f75a6b 100644 --- a/group/lib.php +++ b/group/lib.php @@ -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; diff --git a/lib/accesslib.php b/lib/accesslib.php index a8cc9c09102..4fe6f21baec 100644 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -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.' ???'; diff --git a/lib/cronlib.php b/lib/cronlib.php index 80d2a18c9ce..0bc2f0cebd5 100644 --- a/lib/cronlib.php +++ b/lib/cronlib.php @@ -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; diff --git a/lib/editor/tinymce/classes/plugin.php b/lib/editor/tinymce/classes/plugin.php index 6d41b25c545..3c97c963ad9 100644 --- a/lib/editor/tinymce/classes/plugin.php +++ b/lib/editor/tinymce/classes/plugin.php @@ -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); diff --git a/lib/eventslib.php b/lib/eventslib.php index 4717fb3f6ba..7316a477704 100644 --- a/lib/eventslib.php +++ b/lib/eventslib.php @@ -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(); diff --git a/lib/externallib.php b/lib/externallib.php index e6d868fc031..698a9efc12c 100644 --- a/lib/externallib.php +++ b/lib/externallib.php @@ -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); diff --git a/lib/filelib.php b/lib/filelib.php index 1227f082d3d..669542564a7 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -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(); } diff --git a/lib/messagelib.php b/lib/messagelib.php index c07af1dab2b..d4cd8d09c7f 100644 --- a/lib/messagelib.php +++ b/lib/messagelib.php @@ -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); } @@ -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(); diff --git a/lib/outputfactories.php b/lib/outputfactories.php index 499ca562a57..bb854f41261 100644 --- a/lib/outputfactories.php +++ b/lib/outputfactories.php @@ -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'; diff --git a/lib/outputrequirementslib.php b/lib/outputrequirementslib.php index 517d441b217..75a71039804 100644 --- a/lib/outputrequirementslib.php +++ b/lib/outputrequirementslib.php @@ -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; @@ -704,7 +704,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)); @@ -1647,7 +1647,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); } diff --git a/lib/portfoliolib.php b/lib/portfoliolib.php index 2cff7a0e140..be29c326cae 100644 --- a/lib/portfoliolib.php +++ b/lib/portfoliolib.php @@ -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); } diff --git a/lib/questionlib.php b/lib/questionlib.php index df181a260d8..2a464d03409 100644 --- a/lib/questionlib.php +++ b/lib/questionlib.php @@ -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(); } diff --git a/lib/testing/generator/data_generator.php b/lib/testing/generator/data_generator.php index fe0f34bb9dc..2aba87c6bbd 100644 --- a/lib/testing/generator/data_generator.php +++ b/lib/testing/generator/data_generator.php @@ -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 " . diff --git a/lib/upgradelib.php b/lib/upgradelib.php index e04b0c8089e..32e4637f6ae 100644 --- a/lib/upgradelib.php +++ b/lib/upgradelib.php @@ -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); } } @@ -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); } } @@ -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'); @@ -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; diff --git a/rss/file.php b/rss/file.php index c231c91f06b..0ff00d58b3d 100644 --- a/rss/file.php +++ b/rss/file.php @@ -148,7 +148,7 @@ try { } // Work out which component in Moodle we want (from the frankenstyle name) -$componentdir = get_component_directory($componentname); +$componentdir = core_component::get_component_directory($componentname); list($type, $plugin) = core_component::normalize_component($componentname); diff --git a/webservice/externallib.php b/webservice/externallib.php index fb91001c9bb..ecc78e054d3 100644 --- a/webservice/externallib.php +++ b/webservice/externallib.php @@ -134,7 +134,7 @@ class core_webservice_external extends external_api { if ($function->component == 'moodle' || $function->component == 'core') { $version = $CFG->version; // Moodle version. } else { - $versionpath = get_component_directory($function->component).'/version.php'; + $versionpath = core_component::get_component_directory($function->component).'/version.php'; if (is_readable($versionpath)) { // We store the component version once retrieved (so we don't load twice the version.php). if (!isset($componentversions[$function->component])) {