diff --git a/lib/classes/plugininfo/qbehaviour.php b/lib/classes/plugininfo/qbehaviour.php index b33e22601a0..85de13462a8 100644 --- a/lib/classes/plugininfo/qbehaviour.php +++ b/lib/classes/plugininfo/qbehaviour.php @@ -60,6 +60,11 @@ class qbehaviour extends base { public function is_uninstall_allowed() { global $DB; + if ($this->name === 'missing') { + // qbehaviour_missing is used by the system. It cannot be uninstalled. + return false; + } + return !$DB->record_exists('question_attempts', array('behaviour' => $this->name)); } diff --git a/lib/classes/plugininfo/qtype.php b/lib/classes/plugininfo/qtype.php index 375ee1a10f0..deeae712d8b 100644 --- a/lib/classes/plugininfo/qtype.php +++ b/lib/classes/plugininfo/qtype.php @@ -68,6 +68,11 @@ class qtype extends base { public function is_uninstall_allowed() { global $DB; + if ($this->name === 'missingtype') { + // qtype_missingtype is used by the system. It cannot be uninstalled. + return false; + } + return !$DB->record_exists('question', array('qtype' => $this->name)); }