diff --git a/backup/backuplib.php b/backup/backuplib.php index 73915d0b079..115cb916857 100644 --- a/backup/backuplib.php +++ b/backup/backuplib.php @@ -634,7 +634,6 @@ fwrite ($bf,full_tag("STUDENTS",3,false,$course->students)); fwrite ($bf,full_tag("GUEST",3,false,$course->guest)); fwrite ($bf,full_tag("STARTDATE",3,false,$course->startdate)); - fwrite ($bf,full_tag("ENROLPERIOD",3,false,$course->enrolperiod)); fwrite ($bf,full_tag("NUMSECTIONS",3,false,$course->numsections)); //fwrite ($bf,full_tag("SHOWRECENT",3,false,$course->showrecent)); INFO: This is out in 1.3 fwrite ($bf,full_tag("MAXBYTES",3,false,$course->maxbytes)); @@ -657,6 +656,13 @@ } else { $status = fwrite ($bf,full_tag("METACOURSE",3,false,$course->metacourse)); } + fwrite ($bf,full_tag("EXPIRENOTIFY",3,false,$course->expirynotify)); + fwrite ($bf,full_tag("NOTIFYSTUDENTS",3,false,$course->notifystudents)); + fwrite ($bf,full_tag("EXPIRYTHRESHOLD",3,false,$course->expirythreshold)); + fwrite ($bf,full_tag("ENROLLABLE",3,false,$course->enrollable)); + fwrite ($bf,full_tag("ENROLSTARTDATE",3,false,$course->enrolstartdate)); + fwrite ($bf,full_tag("ENROLENDDATE",3,false,$course->enrolenddate)); + fwrite ($bf,full_tag("ENROLPERIOD",3,false,$course->enrolperiod)); /// write local course overrides here? write_role_overrides_xml($bf, $context, 3); diff --git a/backup/restorelib.php b/backup/restorelib.php index 04ba2f0bf42..fa926a23316 100644 --- a/backup/restorelib.php +++ b/backup/restorelib.php @@ -596,7 +596,6 @@ $course->guest = addslashes($course_header->course_guest); $course->startdate = addslashes($course_header->course_startdate); $course->startdate += $restore->course_startdateoffset; - $course->enrolperiod = addslashes($course_header->course_enrolperiod); $course->numsections = addslashes($course_header->course_numsections); //$course->showrecent = addslashes($course_header->course_showrecent); INFO: This is out in 1.3 $course->maxbytes = addslashes($course_header->course_maxbytes); @@ -617,6 +616,19 @@ $course->timecreated = addslashes($course_header->course_timecreated); $course->timemodified = addslashes($course_header->course_timemodified); $course->metacourse = addslashes($course_header->course_metacourse); + $course->expirynotify = isset($course_header->course_expirynotify) ? addslashes($course_header->course_expirynotify):0; + $course->notifystudents = isset($course_header->course_notifystudents) ? addslashes($course_header->course_notifystudents) : 0; + $course->expirythreshold = isset($course_header->course_expirythreshold) ? addslashes($course_header->course_expirythreshold) : 0; + $course->enrollable = isset($course_header->course_enrollable) ? addslashes($course_header->course_enrollable) : 1; + $course->enrolstartdate = isset($course_header->course_enrolstartdate) ? addslashes($course_header->course_enrolstartdate) : 0; + if ($course->enrolstartdate) { //Roll course dates + $course->enrolstartdate += $restore->course_startdateoffset; + } + $course->enrolenddate = isset($course_header->course_enrolenddate) ? addslashes($course_header->course_enrolenddate) : 0; + if ($course->enrolenddate) { //Roll course dates + $course->enrolenddate += $restore->course_startdateoffset; + } + $course->enrolperiod = addslashes($course_header->course_enrolperiod); //Calculate sortorder field $sortmax = get_record_sql('SELECT MAX(sortorder) AS max FROM ' . $CFG->prefix . 'course @@ -3966,9 +3978,6 @@ case "STARTDATE": $this->info->course_startdate = $this->getContents(); break; - case "ENROLPERIOD": - $this->info->course_enrolperiod = $this->getContents(); - break; case "NUMSECTIONS": $this->info->course_numsections = $this->getContents(); break; @@ -4017,6 +4026,27 @@ case "METACOURSE": $this->info->course_metacourse = $this->getContents(); break; + case "EXPIRENOTIFY": + $this->info->course_expirynotify = $this->getContents(); + break; + case "NOTIFYSTUDENTS": + $this->info->course_notifystudents = $this->getContents(); + break; + case "EXPIRYTHRESHOLD": + $this->info->course_expirythreshold = $this->getContents(); + break; + case "ENROLLABLE": + $this->info->course_enrollable = $this->getContents(); + break; + case "ENROLSTARTDATE": + $this->info->course_enrolstartdate = $this->getContents(); + break; + case "ENROLENDDATE": + $this->info->course_enrolenddate = $this->getContents(); + break; + case "ENROLPERIOD": + $this->info->course_enrolperiod = $this->getContents(); + break; } } if ($this->tree[4] == "CATEGORY") {