From d7ad6ac4efab812bbc07c69e13d3abc2328e15c9 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Thu, 9 Jun 2011 19:57:20 +0100 Subject: [PATCH] MDL-27787 Fix restore of matching quetsions backed up from Moodle 2.0. --- .../restore_qtype_match_plugin.class.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/question/type/match/backup/moodle2/restore_qtype_match_plugin.class.php b/question/type/match/backup/moodle2/restore_qtype_match_plugin.class.php index b8329574ad8..fc1a10613bd 100644 --- a/question/type/match/backup/moodle2/restore_qtype_match_plugin.class.php +++ b/question/type/match/backup/moodle2/restore_qtype_match_plugin.class.php @@ -71,6 +71,24 @@ class restore_qtype_match_plugin extends restore_qtype_plugin { // If the question has been created by restore, we need to create its question_match too if ($questioncreated) { + // Fill in some field that were added in 2.1, and so which may be missing + // from backups made in older versions of Moodle. + if (!isset($data->correctfeedback)) { + $data->correctfeedback = ''; + $data->correctfeedbackformat = FORMAT_HTML; + } + if (!isset($data->partiallycorrectfeedback)) { + $data->partiallycorrectfeedback = ''; + $data->partiallycorrectfeedbackformat = FORMAT_HTML; + } + if (!isset($data->incorrectfeedback)) { + $data->incorrectfeedback = ''; + $data->incorrectfeedbackformat = FORMAT_HTML; + } + if (!isset($data->shownumcorrect)) { + $data->shownumcorrect = 0; + } + // Adjust some columns $data->question = $newquestionid; // Keep question_match->subquestions unmodified