diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2007-01-27 12:30:54 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2007-01-27 12:30:54 +0000 |
commit | 3c5c5154abddff39ec270ca82495a7923e4b254c (patch) | |
tree | 884af8b67353e50a2e1a91c986502bde5d5c2323 /phpBB/install/database_update.php | |
parent | 9ebe6b6b1f05ac8fb0a4fdc395a76224ad17fbe7 (diff) | |
download | forums-3c5c5154abddff39ec270ca82495a7923e4b254c.tar forums-3c5c5154abddff39ec270ca82495a7923e4b254c.tar.gz forums-3c5c5154abddff39ec270ca82495a7923e4b254c.tar.bz2 forums-3c5c5154abddff39ec270ca82495a7923e4b254c.tar.xz forums-3c5c5154abddff39ec270ca82495a7923e4b254c.zip |
#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
Diffstat (limited to 'phpBB/install/database_update.php')
-rw-r--r-- | phpBB/install/database_update.php | 25 |
1 files changed, 18 insertions, 7 deletions
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; <p><?php echo $lang['DATABASE_TYPE']; ?> :: <strong><?php echo $db->sql_layer; ?></strong><br /> <?php -// To let set_config() calls success, we need to make the config array available globally +// To let set_config() calls succeed, we need to make the config array available globally $config = array(); $sql = 'SELECT * FROM ' . CONFIG_TABLE; @@ -627,21 +627,26 @@ if (version_compare($current_version, '3.0.b4', '<=')) WHERE module_class = 'acp' AND module_mode = 'version_check' AND module_auth = 'acl_a_'"; _sql($sql, $errored, $error_ary); - // Because the email hash could have been calculated wrongly, we will update it for every user. + // Because the email hash could have been calculated wrongly as well as the clean string function changed, + // we will update it for every user. + // Since this is not used in a live environment there are not much... not used in a live environment, yes! - $sql = 'SELECT user_id, user_email + $sql = 'SELECT user_id, user_email, username FROM ' . USERS_TABLE; $result = $db->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')) { |