From d80a2fe0318a01f7b46150e0125bb2466aeda789 Mon Sep 17 00:00:00 2001 From: nfreear Date: Fri, 16 Feb 2007 14:45:57 +0000 Subject: [PATCH] Fixes Bug MDL-8545 "Restore bugs, groups-members and role assignments" --- backup/restorelib.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 -- 2.39.5