From 1be0a4c812bb604d43697bea20c27cfd9975156e Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Mon, 28 Apr 2014 21:25:51 +0100 Subject: [PATCH] MDL-45312 qtype_missingtype or qbehaviour_missing cannot be uninstalled. They are required by the system. --- lib/classes/plugininfo/qbehaviour.php | 5 +++++ lib/classes/plugininfo/qtype.php | 5 +++++ 2 files changed, 10 insertions(+) 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)); }