From 3c5c5154abddff39ec270ca82495a7923e4b254c Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 27 Jan 2007 12:30:54 +0000 Subject: #7424 - rebuild username_clean column due to changes in utf8_clean_string() git-svn-id: file:///svn/phpbb/trunk@6934 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/database_update.php | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'phpBB/install/database_update.php') diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 4d8fc449a0..9870b47706 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -411,7 +411,7 @@ $errored = false;

:: sql_layer; ?>
sql_query($sql); while ($row = $db->sql_fetchrow($result)) { + $sql = 'UPDATE ' . USERS_TABLE . " + SET username_clean = '" . $db->sql_escape(utf8_clean_string($row['username'])) . "'"; + if ($row['user_email']) { - $sql = 'UPDATE ' . USERS_TABLE . ' - SET user_email_hash = ' . (crc32($row['user_email']) . strlen($row['user_email'])) . ' - WHERE user_id = ' . $row['user_id']; - _sql($sql, $errored, $error_ary); + $sql .= ', user_email_hash = ' . (crc32($row['user_email']) . strlen($row['user_email'])); } + + $sql .= ' WHERE user_id = ' . $row['user_id']; + _sql($sql, $errored, $error_ary); } $db->sql_freeresult($result); @@ -1355,6 +1360,12 @@ function add_bots() $db->sql_query($sql); } } + else + { + // If the old bots are missing we can safely assume the user tries to execute the database update twice and + // fiddled around... + return; + } if (!function_exists('user_add')) { -- cgit v1.2.1