Merge branch 'MDL-33818' of git://github.com/timhunt/moodle
authorDan Poltawski <dan@moodle.com>
Mon, 18 Jun 2012 13:33:26 +0000 (21:33 +0800)
committerDan Poltawski <dan@moodle.com>
Mon, 18 Jun 2012 13:33:26 +0000 (21:33 +0800)
mod/quiz/backup/moodle2/restore_quiz_stepslib.php

index 036b4e2..58a38d1 100644 (file)
@@ -307,6 +307,15 @@ class restore_quiz_activity_structure_step extends restore_questions_activity_st
         $data->timefinish = $this->apply_date_offset($data->timefinish);
         $data->timemodified = $this->apply_date_offset($data->timemodified);
 
+        // Deals with up-grading pre-2.3 back-ups to 2.3+.
+        if (!isset($data->state)) {
+            if ($data->timefinish > 0) {
+                $data->state = 'finished';
+            } else {
+                $data->state = 'inprogress';
+            }
+        }
+
         // The data is actually inserted into the database later in inform_new_usage_id.
         $this->currentquizattempt = clone($data);
     }