diff --git a/lib/classes/plugin_manager.php b/lib/classes/plugin_manager.php index ea6a3293013..00feacac81c 100644 --- a/lib/classes/plugin_manager.php +++ b/lib/classes/plugin_manager.php @@ -1651,7 +1651,7 @@ class core_plugin_manager { } // To be able to remove the plugin folder, its parent must be writable, too. - if (!is_writable(dirname($pluginfo->rootdir))) { + if (!isset($pluginfo->rootdir) || !is_writable(dirname($pluginfo->rootdir))) { return false; } diff --git a/lib/classes/plugininfo/base.php b/lib/classes/plugininfo/base.php index 40e20de4686..4eb39a1b188 100644 --- a/lib/classes/plugininfo/base.php +++ b/lib/classes/plugininfo/base.php @@ -598,6 +598,10 @@ abstract class base { public function get_dir() { global $CFG; + if (!isset($pluginfo->rootdir)) { + return ''; + } + return substr($this->rootdir, strlen($CFG->dirroot)); }