From: stronk7 Date: Sat, 28 Aug 2004 10:26:06 +0000 (+0000) Subject: Now user->auth is in backup & restore X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=0083049b21a0748dd116a6fe01ab3c94f8a48631;p=moodle.git Now user->auth is in backup & restore Bug 1789 (http://moodle.org/bugs/bug.php?op=show&bugid=1789) Merged from MOODLE_14_STABLE --- diff --git a/backup/backuplib.php b/backup/backuplib.php index 5eebf82785..0388341ddf 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 6872f1e635..7bb74a4b5e 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 ad455836bb..7559768178 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