Permalink
Browse files

MDL-26528 restore - ignore wrong forum_read records

  • Loading branch information...
1 parent 783cca4 commit 9170eb5aab0cf10d34bd21058fbdf4da05d383f7 @stronk7 stronk7 committed Feb 20, 2011
Showing with 5 additions and 10 deletions.
  1. +5 −10 mod/forum/restorelib.php
View
@@ -385,38 +385,33 @@ function forum_read_restore_mods($forum_id,$info,$restore) {
$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
$discussion = backup_getid($restore->backup_unique_code,"forum_discussions",$read->discussionid);
if ($discussion) {
$read->discussionid = $discussion->new_id;
} else {
- $toinsert = false;
+ continue; // Skip this forum_read record
}
//We have to recode the postid field
$post = backup_getid($restore->backup_unique_code,"forum_posts",$read->postid);
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) {

0 comments on commit 9170eb5

Please sign in to comment.