From 1c74b260900815353297537c7592d01d5785636c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20S=CC=8Ckoda?= Date: Tue, 16 Jul 2013 22:38:38 +0200 Subject: [PATCH] MDL-40220 use new core_component::get_plugin_directory() --- admin/qbehaviours.php | 4 ++-- lib/accesslib.php | 2 +- lib/adminlib.php | 2 +- lib/grade/grade_item.php | 2 +- lib/outputlib.php | 2 +- lib/pluginlib.php | 2 +- lib/upgradelib.php | 2 +- mnet/xmlrpc/serverlib.php | 2 +- question/engine/bank.php | 4 ++-- question/engine/tests/helpers.php | 2 +- theme/mymobile/renderers.php | 2 +- 11 files changed, 13 insertions(+), 13 deletions(-) diff --git a/admin/qbehaviours.php b/admin/qbehaviours.php index a000e0ced784e..cb59976e6b652 100644 --- a/admin/qbehaviours.php +++ b/admin/qbehaviours.php @@ -186,14 +186,14 @@ } // 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(); diff --git a/lib/accesslib.php b/lib/accesslib.php index 80a1f664d392b..02df5586b8e78 100644 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -2896,7 +2896,7 @@ function get_component_string($component, $contextlevel) { } list($type, $name) = normalize_component($component); - $dir = get_plugin_directory($type, $name); + $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.' ???'; diff --git a/lib/adminlib.php b/lib/adminlib.php index bc426b2ccd8c3..f10b899f371d5 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -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); diff --git a/lib/grade/grade_item.php b/lib/grade/grade_item.php index 8d66765b1c352..9ca8c363d9ca4 100644 --- a/lib/grade/grade_item.php +++ b/lib/grade/grade_item.php @@ -2094,7 +2094,7 @@ public function get_coefstring() { * @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; diff --git a/lib/outputlib.php b/lib/outputlib.php index 03407525f6ec1..8a0b0464cc9aa 100644 --- a/lib/outputlib.php +++ b/lib/outputlib.php @@ -1228,7 +1228,7 @@ public function resolve_image_location($image, $component, $svg = false) { 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; } diff --git a/lib/pluginlib.php b/lib/pluginlib.php index cf7a75101c677..c4fa6b106211f 100644 --- a/lib/pluginlib.php +++ b/lib/pluginlib.php @@ -2304,7 +2304,7 @@ protected function component_writable($component) { list($plugintype, $pluginname) = 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); diff --git a/lib/upgradelib.php b/lib/upgradelib.php index a84fc7abf3d09..a11c4ead72c9e 100644 --- a/lib/upgradelib.php +++ b/lib/upgradelib.php @@ -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(); diff --git a/mnet/xmlrpc/serverlib.php b/mnet/xmlrpc/serverlib.php index 64c147c4bbc5c..b6de9720c0404 100644 --- a/mnet/xmlrpc/serverlib.php +++ b/mnet/xmlrpc/serverlib.php @@ -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); diff --git a/question/engine/bank.php b/question/engine/bank.php index b104da2834f0e..2cf05dc0e86b2 100644 --- a/question/engine/bank.php +++ b/question/engine/bank.php @@ -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 @@ public static function get_qtype($qtypename, $mustexist = true) { 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); diff --git a/question/engine/tests/helpers.php b/question/engine/tests/helpers.php index a55c6c8fb8a0e..4ca15caf3d068 100644 --- a/question/engine/tests/helpers.php +++ b/question/engine/tests/helpers.php @@ -207,7 +207,7 @@ public static function get_test_helper($qtype) { return self::$testhelpers[$qtype]; } - $file = get_plugin_directory('qtype', $qtype) . '/tests/helper.php'; + $file = core_component::get_plugin_directory('qtype', $qtype) . '/tests/helper.php'; if (!is_readable($file)) { throw new coding_exception('Question type ' . $qtype . ' does not have test helper code.'); diff --git a/theme/mymobile/renderers.php b/theme/mymobile/renderers.php index a0005da5b21b3..2969e972d2e8b 100644 --- a/theme/mymobile/renderers.php +++ b/theme/mymobile/renderers.php @@ -804,7 +804,7 @@ protected function render_single_select(single_select $select) { * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -$choice = get_plugin_directory('mod', 'choice'); +$choice = core_component::get_plugin_directory('mod', 'choice'); if (file_exists($choice . '/renderer.php')) { require_once($CFG->dirroot . '/theme/mymobile/renderers/mod_choice_renderer.php'); }