From: nfreear Date: Fri, 16 Feb 2007 14:45:57 +0000 (+0000) Subject: Fixes Bug MDL-8545 "Restore bugs, groups-members and role assignments" X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=d80a2fe0318a01f7b46150e0125bb2466aeda789;p=moodle.git Fixes Bug MDL-8545 "Restore bugs, groups-members and role assignments" --- diff --git a/backup/restorelib.php b/backup/restorelib.php index e1cfecd1d7..ac10801127 100644 --- a/backup/restorelib.php +++ b/backup/restorelib.php @@ -2229,6 +2229,10 @@ $status = true; + if (! isset($info['GROUP']['#']['MEMBERS']['0']['#']['MEMBER'])) { + //OK, some groups have no members. + return $status; + } //Get the members array $members = $info['GROUP']['#']['MEMBERS']['0']['#']['MEMBER']; @@ -6625,7 +6629,8 @@ foreach ($assignments as $assignment) { $olduser = backup_getid($restore->backup_unique_code,"user",$assignment->userid); - if (!$olduser || $olduser->info == "notincourse") { // it's possible that user is not in the course + //Oh dear, $olduser... can be an object, $obj->string or bool! + if (!$olduser || (is_string($olduser->info) && $olduser->info == "notincourse")) { // it's possible that user is not in the course continue; } $assignment->userid = $olduser->new_id; // new userid here