]> git.mjollnir.org Git - moodle.git/commitdiff
added support for:
authorstronk7 <stronk7>
Sun, 30 Jan 2005 11:39:12 +0000 (11:39 +0000)
committerstronk7 <stronk7>
Sun, 30 Jan 2005 11:39:12 +0000 (11:39 +0000)
    - user->policyagreed:
        if the destination server is different, reset it
   - user_students->enrol and user_teachers->enrol
        if not set or the destination server is different, set it to $CFG->enrol
somethings should be modified in the rest of moodle:
    - update all the 'manual' entries to 'internal'
    - modify the enrol_teacher() to use $CFG->enrol by default
    - make every enrol method set this field properly.
    - perhaps, mark metadata users with a new value too.

backup/CHANGES_14_15.txt
backup/backuplib.php
backup/restorelib.php

index b87ff97bcc5c02e98816c7c1728104e85d1f4c52..54df8b31b2e23025044ff389c3bbcd0b5dfeb3d1 100644 (file)
@@ -11,9 +11,9 @@ Now I show the specific detailed status of every item in the process:
  1. DONE: check user->idnumber
  2. DONE: check user->lang (at restore set mi_nt where ma_nt).
  3. DONE: check course->lang (at restore set mi_nt where ma_nt).
- 4. TODO: user_students->enrol (analyse and proceed).
- 5. TODO: user_teachers->enrol (analyse and proceed).
- 6. TODO: user->policyagreed (analyse and proceed).
+ 4. DONE: user_students->enrol (analyse and proceed).
+ 5. DONE: user_teachers->enrol (analyse and proceed).
+ 6. DONE: user->policyagreed (analyse and proceed).
  7. TODO: groups->password
  8. TODO: assignment->emailteachers
  9. TODO: exercise->usepassword and exercise->password
index a8b453b67a7a88b35c50a6e527b9734214debae1..58f46744751b5946ca2468e0dca521ac317f626a 100644 (file)
                 fwrite ($bf,full_tag("AUTH",4,false,$user_data->auth));
                 fwrite ($bf,full_tag("GUID",4,false,$user_data->guid));
                 fwrite ($bf,full_tag("CONFIRMED",4,false,$user_data->confirmed));
+                fwrite ($bf,full_tag("POLICYAGREED",4,false,$user_data->policyagreed));
                 fwrite ($bf,full_tag("DELETED",4,false,$user_data->deleted));
                 fwrite ($bf,full_tag("USERNAME",4,false,$user_data->username));
                 fwrite ($bf,full_tag("PASSWORD",4,false,$user_data->password));
                         fwrite ($bf,full_tag("TIMEEND",6,false,$tea->timeend));
                         fwrite ($bf,full_tag("TIMEMODIFIED",6,false,$tea->timemodified));
                         fwrite ($bf,full_tag("TIMEACCESS",6,false,$tea->timeaccess));
+                        fwrite ($bf,full_tag("ENROL",6,false,$tea->enrol));
                         //Print ROLE end
                         fwrite ($bf,end_tag("ROLE",5,true));   
                     }
                         fwrite ($bf,full_tag("TIMEEND",6,false,$stu->timeend));
                         fwrite ($bf,full_tag("TIME",6,false,$stu->time));
                         fwrite ($bf,full_tag("TIMEACCESS",6,false,$stu->timeaccess));
+                        fwrite ($bf,full_tag("ENROL",6,false,$stu->enrol));
                         //Print ROLE end
                         fwrite ($bf,end_tag("ROLE",5,true));   
                     }
index 2149597a95350fa9b50a0304ee8787995fac3302..0d4d9fa27d3af14249b60afca1197a810a28aec8 100644 (file)
                         $user->auth = $CFG->auth;
                     }
 
+                    //We need to process the POLICYAGREED field to recalculate it:
+                    //    - if the destination site is different (by wwwroot) reset it.
+                    //    - if the destination site is the same (by wwwroot), leave it unmodified
+
+                    if ($restore->original_wwwroot != $CFG->wwwroot) {
+                        $user->policyagreed = 0;
+                    } else {
+                        //Nothing to do, we are in the same server
+                    }
+
                     //We are going to create the user
                     //The structure is exactly as we need
                     $newid = insert_record ("user",$user);
                             //Set course and user
                             $user->roles['teacher']->course = $restore->course_id;
                             $user->roles['teacher']->userid = $newid;
+
+                            //Need to analyse the enrol field
+                            //    - if it isn't set, set it to $CFG->enrol
+                            //    - if we are in a different server (by wwwroot), set it to $CFG->enrol
+                            //    - if we are in the same server (by wwwroot), maintain it unmodified.
+                            if (empty($user->roles['teacher']->enrol)) {
+                                $user->roles['teacher']->enrol = $CFG->enrol;
+                            } else if ($restore->original_wwwroot != $CFG->wwwroot) {
+                                $user->roles['teacher']->enrol = $CFG->enrol;
+                            } else {
+                                //Nothing to do. Leave it unmodified
+                            }    
+
                             //Insert data in user_teachers
                             //The structure is exactly as we need
                             $status = insert_record("user_teachers",$user->roles['teacher']);
                             //Set course and user
                             $user->roles['student']->course = $restore->course_id;
                             $user->roles['student']->userid = $newid;
+
+                            //Need to analyse the enrol field
+                            //    - if it isn't set, set it to $CFG->enrol
+                            //    - if we are in a different server (by wwwroot), set it to $CFG->enrol
+                            //    - if we are in the same server (by wwwroot), maintain it unmodified.
+                            if (empty($user->roles['student']->enrol)) {
+                                $user->roles['student']->enrol = $CFG->enrol;
+                            } else if ($restore->original_wwwroot != $CFG->wwwroot) {
+                                $user->roles['student']->enrol = $CFG->enrol;
+                            } else {
+                                //Nothing to do. Leave it unmodified
+                            }    
+
                             //Insert data in user_students
                             //The structure is exactly as we need
                             $status = insert_record("user_students",$user->roles['student']);
                         case "CONFIRMED": 
                             $this->info->tempuser->confirmed = $this->getContents();
                             break;
+                        case "POLICYAGREED": 
+                            $this->info->tempuser->policyagreed = $this->getContents();
+                            break;
                         case "DELETED": 
                             $this->info->tempuser->deleted = $this->getContents();
                             break;
                         case "TIMEACCESS":
                             $this->info->temprole->timeaccess = $this->getContents();
                             break;
+                        case "ENROL":
+                            $this->info->temprole->enrol = $this->getContents();
+                            break;
                         case "NAME":
                             $this->info->tempuserpreference->name = $this->getContents();
                             break;