Skip to content

Commit

Permalink
MDL-40220 use new core_component::get_plugin_directory()
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Jul 16, 2013
1 parent 059e08e commit 1c74b26
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions admin/qbehaviours.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion lib/accesslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.' ???';
Expand Down
2 changes: 1 addition & 1 deletion lib/adminlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion lib/grade/grade_item.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/outputlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/pluginlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion lib/upgradelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion mnet/xmlrpc/serverlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions question/engine/bank.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion question/engine/tests/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
Expand Down
2 changes: 1 addition & 1 deletion theme/mymobile/renderers.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

0 comments on commit 1c74b26

Please sign in to comment.