MDL-27787 Fix restore of matching quetsions backed up from Moodle 2.0.

This commit is contained in:
Tim Hunt 2011-06-09 19:57:20 +01:00
parent 7a5f3a3cc7
commit d7ad6ac4ef

View File

@ -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