aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/install
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2007-07-24 15:17:47 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2007-07-24 15:17:47 +0000
commit306581d905c508e6d4a7bafebce1b90dbedbbf4a (patch)
tree35b44aa977eea4d109dc5600a5ca781f8eb4aaee /phpBB/install
parent9242d6f9985eb01afa1b688b74c88876b2f8dc17 (diff)
downloadforums-306581d905c508e6d4a7bafebce1b90dbedbbf4a.tar
forums-306581d905c508e6d4a7bafebce1b90dbedbbf4a.tar.gz
forums-306581d905c508e6d4a7bafebce1b90dbedbbf4a.tar.bz2
forums-306581d905c508e6d4a7bafebce1b90dbedbbf4a.tar.xz
forums-306581d905c508e6d4a7bafebce1b90dbedbbf4a.zip
this should work fine now...
git-svn-id: file:///svn/phpbb/trunk@7937 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/install')
-rw-r--r--phpBB/install/database_update.php66
1 files changed, 49 insertions, 17 deletions
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index 082d9a530e..74ffdc8c8a 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -1,14 +1,14 @@
<?php
-/**
+/**
*
* @package install
* @version $Id$
-* @copyright (c) 2006 phpBB Group
-* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+* @copyright (c) 2006 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
-$updates_to_version = '3.0.RC3';
+$updates_to_version = '3.0.RC4';
if (defined('IN_PHPBB') && defined('IN_INSTALL'))
{
@@ -492,15 +492,24 @@ else
$exit = false;
if (version_compare($current_version, '3.0.RC3', '<='))
{
-/*
- </p>
+ if (!isset($lang['CLEANING_USERNAMES']))
+ {
+ $lang['CLEANING_USERNAMES'] = 'Cleaning usernames';
+ }
+
+ if (!isset($lang['LONG_SCRIPT_EXECUTION']))
+ {
+ $lang['LONG_SCRIPT_EXECUTION'] = 'Please note that this can take a while... Please do not stop the script.';
+ }
+
+?>
+ </p><br /><br />
- <h1>Clean Usernames</h1>
+ <h1><?php echo $lang['CLEANING_USERNAMES']; ?></h1>
<br />
- <p>Please note that this can take a while... Please do not stop the script.</p>
-*/
+<?php
flush();
$submit = (isset($_POST['resolve_conflicts'])) ? true : false;
@@ -593,7 +602,12 @@ if (version_compare($current_version, '3.0.RC3', '<='))
}
}
}
+?>
+
+ <p><?php echo $lang['LONG_SCRIPT_EXECUTION']; ?></p>
+ <p><?php echo $lang['PROGRESS']; ?> :: <strong>
+<?php
// after RC3 a different utf8_clean_string function is used, this requires that
// the unique column username_clean is recalculated, during this recalculation
// duplicates might be created. Since the column has to be unique such usernames
@@ -605,13 +619,17 @@ if (version_compare($current_version, '3.0.RC3', '<='))
$result = $db->sql_query($sql);
$colliding_users = $found_names = array();
+ $echos = 0;
+
while ($row = $db->sql_fetchrow($result))
{
// Calculate the new clean name. If it differs from the old one we need
// to make sure there is no collision
$clean_name = utf8_new_clean_string($row['username']);
+
if ($clean_name != $row['username_clean'])
{
+ // Check if there would be a collission, if not put it up for changing
$user_id = (int) $row['user_id'];
// If this clean name was not the result of another user already ...
@@ -621,14 +639,18 @@ if (version_compare($current_version, '3.0.RC3', '<='))
// who already had this clean name with the old version
$sql = 'SELECT user_id, username
FROM ' . USERS_TABLE . '
- WHERE username_clean = \'' . $db->sql_escape($clean_name) . '\'
- AND user_id > ' . $user_id . '
- ORDER BY user_id';
+ WHERE username_clean = \'' . $db->sql_escape($clean_name) . '\'';
$result2 = $db->sql_query($sql);
$user_ids = array($user_id);
while ($row = $db->sql_fetchrow($result2))
{
+ // For not trimmed entries this could happen, yes. ;)
+ if ($row['user_id'] == $user_id)
+ {
+ continue;
+ }
+
// Make sure this clean name will still be the same with the
// new function. If it is, then we have to add it to the list
// of user ids for this clean name
@@ -672,6 +694,13 @@ if (version_compare($current_version, '3.0.RC3', '<='))
}
}
}
+
+ if (($echos % 1000) == 0)
+ {
+ echo '.';
+ flush();
+ }
+ $echos++;
}
$db->sql_freeresult($result);
@@ -730,7 +759,8 @@ if (version_compare($current_version, '3.0.RC3', '<='))
// for the admin: keep name, change name (with text input) or delete user
$u_action = "database_update.$phpEx?language=$language&amp;type=$inline_update";
?>
-</p>
+</strong></p><br /><br />
+
<p><?php echo $lang['CHANGE_CLEAN_NAMES']; ?></p>
<form id="change_clean_names" method="post" action="<?php echo $u_action; ?>">
@@ -830,7 +860,7 @@ if (version_compare($current_version, '3.0.RC3', '<='))
</form>
<?php
}
- else
+ else if (sizeof($found_names))
{
$sql = 'SELECT user_id, username, username_clean
FROM ' . USERS_TABLE . '
@@ -841,14 +871,16 @@ if (version_compare($current_version, '3.0.RC3', '<='))
while ($row = $db->sql_fetchrow($result))
{
$clean_name = utf8_new_clean_string($row['username']);
+
if ($clean_name != $row['username_clean'])
{
$user_id = (int) $row['user_id'];
$found_names[$user_id] = $clean_name;
+
// impossible unique clean name
- $sql = 'UPDATE ' . USERS_TABLE . '
- SET username_clean = \' ' . $user_id . '\'
- WHERE user_id = ' . $user_id;
+ $sql = 'UPDATE ' . USERS_TABLE . "
+ SET username_clean = ' {$user_id}'
+ WHERE user_id = {$user_id}";
$db->sql_query($sql);
}
}