diff --git a/backup/backuplib.php b/backup/backuplib.php index 5eebf827854..0388341ddf2 100644 --- a/backup/backuplib.php +++ b/backup/backuplib.php @@ -720,6 +720,7 @@ 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)); diff --git a/backup/restorelib.php b/backup/restorelib.php index 6872f1e635f..7bb74a4b5ec 100644 --- a/backup/restorelib.php +++ b/backup/restorelib.php @@ -808,6 +808,17 @@ $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); @@ -2427,6 +2438,9 @@ $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; diff --git a/backup/version.php b/backup/version.php index ad455836bb2..75597681781 100644 --- a/backup/version.php +++ b/backup/version.php @@ -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