From 72df03235e49a41372027e5cd17144964b22a3b7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Petr=20S=CC=8Ckoda?= Date: Wed, 25 Sep 2013 09:57:19 +0200 Subject: [PATCH] MDL-41437 implement plugininfo_quiz necessary for quiz report uninstall --- mod/quiz/adminlib.php | 57 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 mod/quiz/adminlib.php diff --git a/mod/quiz/adminlib.php b/mod/quiz/adminlib.php new file mode 100644 index 00000000000..16ff793bb4d --- /dev/null +++ b/mod/quiz/adminlib.php @@ -0,0 +1,57 @@ +. + +/** + * Quiz admin stuff. + * + * @package mod_quiz + * @copyright 2013 Petr Skoda {@link http://skodak.org} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + + +/** + * Quiz admin stuff. + * + * @package mod_quiz + * @copyright 2013 Petr Skoda {@link http://skodak.org} + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class plugininfo_quiz extends plugininfo_base { + public function is_uninstall_allowed() { + return true; + } + + /** + * Pre-uninstall hook. + * + * This is intended for disabling of plugin, some DB table purging, etc. + * + * NOTE: to be called from uninstall_plugin() only. + * @private + */ + public function uninstall_cleanup() { + global $DB; + + // Do the opposite of db/install.php scripts - deregister the report. + + $DB->delete_records('quiz_reports', array('name'=>$this->name)); + + parent::uninstall_cleanup(); + } +} -- 2.43.0