From 9170eb5aab0cf10d34bd21058fbdf4da05d383f7 Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Sun, 20 Feb 2011 23:30:25 +0100 Subject: [PATCH] MDL-26528 restore - ignore wrong forum_read records --- mod/forum/restorelib.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/mod/forum/restorelib.php b/mod/forum/restorelib.php index ee7d177ddfe..be9dade2148 100644 --- a/mod/forum/restorelib.php +++ b/mod/forum/restorelib.php @@ -385,15 +385,12 @@ $read->firstread = backup_todb($rea_info['#']['FIRSTREAD']['0']['#']); $read->lastread = backup_todb($rea_info['#']['LASTREAD']['0']['#']); - //Some recoding and check are performed now - $toinsert = true; - //We have to recode the userid field $user = backup_getid($restore->backup_unique_code,"user",$read->userid); if ($user) { $read->userid = $user->new_id; } else { - $toinsert = false; + continue; // Skip this forum_read record } //We have to recode the discussionid field @@ -401,7 +398,7 @@ if ($discussion) { $read->discussionid = $discussion->new_id; } else { - $toinsert = false; + continue; // Skip this forum_read record } //We have to recode the postid field @@ -409,14 +406,12 @@ if ($post) { $read->postid = $post->new_id; } else { - $toinsert = false; + continue; // Skip this forum_read record } - //The structure is equal to the db, so insert the forum_read + // Arrived here, the structure is equal to the db, so insert the forum_read $newid = 0; - if ($toinsert) { - $newid = insert_record ("forum_read",$read); - } + $newid = insert_record ("forum_read",$read); //Do some output if (($i+1) % 50 == 0) {