diff --git a/backup/restorelib.php b/backup/restorelib.php index 7bb74a4b5ec..8b2d5ca8ed4 100644 --- a/backup/restorelib.php +++ b/backup/restorelib.php @@ -810,12 +810,14 @@ $user->description = restore_decode_absolute_links(addslashes($user->description)); //We need to analyse the AUTH field to recode it: + // - if the field isn't set, we are in a pre 1.4 backup and we'll + // use $CFG->auth // - 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)) { + if ((! isset($user->auth)) || is_internal_auth($CFG->auth)) { $user->auth = $CFG->auth; }