From 1f5645bc574a1f9ac0fc23d1fb8d90e1b04059cf Mon Sep 17 00:00:00 2001 From: tjhunt Date: Wed, 18 Jun 2008 14:29:37 +0000 Subject: [PATCH] MDL-15290 - Missing question types not handled properly on backup. --- question/backuplib.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/question/backuplib.php b/question/backuplib.php index f09284c062..762093446b 100644 --- a/question/backuplib.php +++ b/question/backuplib.php @@ -176,6 +176,12 @@ $counter = 0; //Iterate over each question foreach ($questions as $question) { + // Deal with missing question types - they need to be included becuase + // user data or quizzes may refer to them. + if (!array_key_exists($question->qtype, $QTYPES)) { + $question->qtype = 'missingtype'; + $question->questiontext = '

' . get_string('warningmissingtype', 'quiz') . '

' . $question->questiontext; + } //Start question $status = $status && fwrite ($bf,start_tag("QUESTION",$level + 1,true)); //Print question contents -- 2.39.5