MDL-49803 mod_quiz: Fixing overrides restore
authorDavid Monllao <davidm@moodle.com>
Thu, 9 Apr 2015 06:59:17 +0000 (14:59 +0800)
committerDavid Monllao <davidm@moodle.com>
Wed, 15 Apr 2015 07:29:38 +0000 (15:29 +0800)
mod/quiz/backup/moodle2/restore_quiz_stepslib.php

index 493dabd..ed4f87e 100644 (file)
@@ -327,8 +327,13 @@ class restore_quiz_activity_structure_step extends restore_questions_activity_st
 
         $data->quiz = $this->get_new_parentid('quiz');
 
-        $data->userid = $this->get_mappingid('user', $data->userid);
-        $data->groupid = $this->get_mappingid('group', $data->groupid);
+        if ($data->userid !== null) {
+            $data->userid = $this->get_mappingid('user', $data->userid);
+        }
+
+        if ($data->groupid !== null) {
+            $data->groupid = $this->get_mappingid('group', $data->groupid);
+        }
 
         $data->timeopen = $this->apply_date_offset($data->timeopen);
         $data->timeclose = $this->apply_date_offset($data->timeclose);