]> git.mjollnir.org Git - moodle.git/commitdiff
Adding some course->xxxx missing fields to backup & restore. MDL-10444
authorstronk7 <stronk7>
Mon, 16 Jul 2007 20:18:26 +0000 (20:18 +0000)
committerstronk7 <stronk7>
Mon, 16 Jul 2007 20:18:26 +0000 (20:18 +0000)
Merged from MOODLE_18_STABLE

backup/backuplib.php
backup/restorelib.php

index 73915d0b0797d36c2629a00dc9d4d2a1fd6a4598..115cb916857096020ed95ec23080a8721d6c3da7 100644 (file)
             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));
             } 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);
index 04ba2f0bf424f0ff52c79a2ab7c6de3d9acf4fa9..fa926a23316c6bf8eaa835f5283896eda8a163cf 100644 (file)
             $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);
             $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
                         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;
                         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") {