From a329802431f744e7e8c93de30be27ec93397d12b Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Mon, 31 Dec 2001 22:00:59 +0000 Subject: [PATCH] Fix bug #498194 git-svn-id: file:///svn/phpbb/trunk@1757 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/upgrade.php | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/phpBB/upgrade.php b/phpBB/upgrade.php index ad1c7eb785..3b53275875 100644 --- a/phpBB/upgrade.php +++ b/phpBB/upgrade.php @@ -1216,18 +1216,23 @@ if( !empty($next) ) WHERE u.user_id IS NULL"; $result = query($sql, "Couldn't obtain list of deleted users"); - $post_id_ary = array(); - while( $row = $db->sql_fetchrow($result) ) + $users_removed = $db->sql_numrows($result); + + if( $users_removed ) { - $post_id_ary[] = $row['post_id']; + $post_id_ary = array(); + while( $row = $db->sql_fetchrow($result) ) + { + $post_id_ary[] = $row['post_id']; + } + + $sql = "UPDATE " . POSTS_TABLE . " + SET poster_id = " . ANONYMOUS . ", enable_sig = 0 + WHERE post_id IN (" . implode(", ", $post_id_ary) . ")"; + query($sql, "Couldn't update posts to remove deleted user poster_id values"); } - $sql = "UPDATE " . POSTS_TABLE . " - SET poster_id = " . ANONYMOUS . ", enable_sig = 0 - WHERE post_id IN (" . implode(", ", $post_id_ary) . ")"; - query($sql, "Couldn't update posts to remove deleted user poster_id values"); - - print "Done
\n"; + print "Removed $users_removed Users ... Done
\n"; echo "
Complete
\n"; end_step('convert_pm');