From 2b18a45e61b9bd36dc70ae567ccc8ae778cd9b47 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Fri, 18 Jan 2013 11:27:53 +0000 Subject: [PATCH] MDL-28512 qtype essay: clean up properly when a question is deleted. --- question/type/essay/questiontype.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/question/type/essay/questiontype.php b/question/type/essay/questiontype.php index dac965ee143..10a13461a6c 100644 --- a/question/type/essay/questiontype.php +++ b/question/type/essay/questiontype.php @@ -80,6 +80,13 @@ class qtype_essay extends question_type { $question->graderinfoformat = $questiondata->options->graderinfoformat; } + public function delete_question($questionid, $contextid) { + global $DB; + + $DB->delete_records('qtype_essay_options', array('questionid' => $questionid)); + parent::delete_question($questionid, $contextid); + } + /** * @return array the different response formats that the question type supports. * internal name => human-readable name.