MDL-59011 restore: Check for userride only for activity events
authorAnkit Agarwal <ankit@moodle.com>
Mon, 22 May 2017 08:48:04 +0000 (14:18 +0530)
committerAnkit Agarwal <ankit@moodle.com>
Wed, 24 May 2017 04:28:46 +0000 (09:58 +0530)
backup/moodle2/restore_stepslib.php

index bfd741b..5d607ef 100644 (file)
@@ -2658,8 +2658,9 @@ class restore_calendarevents_structure_step extends restore_structure_step {
         $isuseroverride = !$data->courseid && $data->modulename && $data->instance;
 
         // If we don't want to include user data and this record is a user override event
-        // for an activity then we should not create it.
-        if (!$this->task->get_setting_value('userinfo') && $isuseroverride) {
+        // for an activity then we should not create it. (Only activity events can be user override events - which must have this
+        // setting).
+        if ($isuseroverride && $this->task->setting_exists('userinfo') && !$this->task->get_setting_value('userinfo')) {
             return;
         }