MDL-31355 mod_forum: backup and restore of duedate and cutoffdate fields
authorShamim Rezaie <shamim@moodle.com>
Wed, 3 Apr 2019 13:21:38 +0000 (00:21 +1100)
committerShamim Rezaie <shamim@moodle.com>
Wed, 10 Apr 2019 16:03:02 +0000 (02:03 +1000)
mod/forum/backup/moodle2/backup_forum_stepslib.php
mod/forum/backup/moodle2/restore_forum_stepslib.php

index 63f45d9..7bc891f 100644 (file)
@@ -39,7 +39,7 @@ class backup_forum_activity_structure_step extends backup_activity_structure_ste
         // Define each element separated
 
         $forum = new backup_nested_element('forum', array('id'), array(
-            'type', 'name', 'intro', 'introformat',
+            'type', 'name', 'intro', 'introformat', 'duedate', 'cutoffdate',
             'assessed', 'assesstimestart', 'assesstimefinish', 'scale',
             'maxbytes', 'maxattachments', 'forcesubscribe', 'trackingtype',
             'rsstype', 'rssarticles', 'timemodified', 'warnafter',
index 771fd41..855e25c 100644 (file)
@@ -62,6 +62,14 @@ class restore_forum_activity_structure_step extends restore_activity_structure_s
 
         // Any changes to the list of dates that needs to be rolled should be same during course restore and course reset.
         // See MDL-9367.
+        if (!isset($data->duedate)) {
+            $data->duedate = 0;
+        }
+        $data->duedate = $this->apply_date_offset($data->duedate);
+        if (!isset($data->cutoffdate)) {
+            $data->cutoffdate = 0;
+        }
+        $data->cutoffdate = $this->apply_date_offset($data->cutoffdate);
         $data->assesstimestart = $this->apply_date_offset($data->assesstimestart);
         $data->assesstimefinish = $this->apply_date_offset($data->assesstimefinish);
         if ($data->scale < 0) { // scale found, get mapping