]> git.mjollnir.org Git - moodle.git/commitdiff
Now user->auth is in backup & restore
authorstronk7 <stronk7>
Sat, 28 Aug 2004 10:26:06 +0000 (10:26 +0000)
committerstronk7 <stronk7>
Sat, 28 Aug 2004 10:26:06 +0000 (10:26 +0000)
Bug 1789
(http://moodle.org/bugs/bug.php?op=show&bugid=1789)

Merged from MOODLE_14_STABLE

backup/backuplib.php
backup/restorelib.php
backup/version.php

index 5eebf8278548adae2680ae61725772d0ca7594a3..0388341ddf2bab0740af09e012bf8a1ebc959a20 100644 (file)
                 fwrite ($bf,start_tag("USER",3,true));
                 //Output all user data
                 fwrite ($bf,full_tag("ID",4,false,$user_data->id));
+                fwrite ($bf,full_tag("AUTH",4,false,$user_data->auth));
                 fwrite ($bf,full_tag("CONFIRMED",4,false,$user_data->confirmed));
                 fwrite ($bf,full_tag("DELETED",4,false,$user_data->deleted));
                 fwrite ($bf,full_tag("USERNAME",4,false,$user_data->username));
index 6872f1e635f37c85f95e0aad6d9949c22bcf66c5..7bb74a4b5ece966bd30b78c79f7b80fe90dac004 100644 (file)
                     $user->city = addslashes($user->city);
                     $user->url = addslashes($user->url);
                     $user->description = restore_decode_absolute_links(addslashes($user->description));
+
+                    //We need to analyse the AUTH field to recode it:
+                    //   - if the destination site has any kind of INTERNAL authentication, 
+                    //     then apply it to the new user.
+                    //   - if the destination site has any kind of EXTERNAL authentication, 
+                    //     then leave the original authentication of the user.
+
+                    if (is_internal_auth($CFG->auth)) {
+                        $user->auth = $CFG->auth;
+                    }
+
                     //We are going to create the user
                     //The structure is exactly as we need
                     $newid = insert_record ("user",$user);
                             $this->info->users[$this->getContents()] = $this->getContents();
                             $this->info->tempuser->id = $this->getContents();
                             break;
+                        case "AUTH": 
+                            $this->info->tempuser->auth = $this->getContents();
+                            break;
                         case "CONFIRMED": 
                             $this->info->tempuser->confirmed = $this->getContents();
                             break;
index ad455836bb2ea2a3bd780f1d4450063bcfb25fae..75597681781c50365ffba32aabafadc669167fd9 100644 (file)
@@ -5,6 +5,6 @@
 // database (backup_version) to determine whether upgrades should
 // be performed (see db/backup_*.php)
 
-$backup_version = 2004082500;   // The current version is a date (YYYYMMDDXX)
+$backup_version = 2004082800;   // The current version is a date (YYYYMMDDXX)
 
 $backup_release = "1.5 development";  // User-friendly version number