MDL-37378 quiz restore: timecheckstate not in old backups.
authorTim Hunt <T.J.Hunt@open.ac.uk>
Mon, 7 Jan 2013 15:56:20 +0000 (15:56 +0000)
committerTim Hunt <T.J.Hunt@open.ac.uk>
Fri, 11 Jan 2013 13:03:10 +0000 (13:03 +0000)
We need to avoid a notice. If the value is missing, setting it to 0 is
fine. It will get sorted out the next time cron is run.

mod/quiz/backup/moodle2/restore_quiz_stepslib.php

index 8014bc1..d4a384b 100644 (file)
@@ -306,7 +306,11 @@ class restore_quiz_activity_structure_step extends restore_questions_activity_st
         $data->timestart = $this->apply_date_offset($data->timestart);
         $data->timefinish = $this->apply_date_offset($data->timefinish);
         $data->timemodified = $this->apply_date_offset($data->timemodified);
-        $data->timecheckstate = $this->apply_date_offset($data->timecheckstate);
+        if (!empty($data->timecheckstate)) {
+            $data->timecheckstate = $this->apply_date_offset($data->timecheckstate);
+        } else {
+            $data->timecheckstate = 0;
+        }
 
         // Deals with up-grading pre-2.3 back-ups to 2.3+.
         if (!isset($data->state)) {