diff options
| author | Meik Sievertsen <acydburn@phpbb.com> | 2009-10-04 18:14:59 +0000 |
|---|---|---|
| committer | Meik Sievertsen <acydburn@phpbb.com> | 2009-10-04 18:14:59 +0000 |
| commit | 2e17e448deed073f8614bb555a8ef20c57291c2a (patch) | |
| tree | 533007e53d3584d0887b0f639d0e673b1e15ea7a /phpBB/develop/adjust_usernames.php | |
| parent | bf8ac19eaa8d74f9dfd6d597190f5664e7339382 (diff) | |
| download | forums-2e17e448deed073f8614bb555a8ef20c57291c2a.tar forums-2e17e448deed073f8614bb555a8ef20c57291c2a.tar.gz forums-2e17e448deed073f8614bb555a8ef20c57291c2a.tar.bz2 forums-2e17e448deed073f8614bb555a8ef20c57291c2a.tar.xz forums-2e17e448deed073f8614bb555a8ef20c57291c2a.zip | |
Copy 3.0.x branch to trunk
git-svn-id: file:///svn/phpbb/trunk@10211 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/develop/adjust_usernames.php')
| -rw-r--r-- | phpBB/develop/adjust_usernames.php | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/phpBB/develop/adjust_usernames.php b/phpBB/develop/adjust_usernames.php new file mode 100644 index 0000000000..1afa77af16 --- /dev/null +++ b/phpBB/develop/adjust_usernames.php @@ -0,0 +1,52 @@ +<?php +/** +* Adjust username_clean column. +* +* You should make a backup from your users table in case something goes wrong +*/ +die("Please read the first lines of this script for instructions on how to enable it"); + +set_time_limit(0); + +define('IN_PHPBB', true); +$phpbb_root_path = './../'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); +include($phpbb_root_path . 'common.'.$phpEx); + +// Start session management +$user->session_begin(); +$auth->acl($user->data); +$user->setup(); + +$echos = 0; + +$sql = 'SELECT user_id, 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'])) . "' + WHERE user_id = " . $row['user_id']; + $db->sql_query($sql); + + if ($echos > 200) + { + echo '<br />' . "\n"; + $echos = 0; + } + + echo '.'; + $echos++; + + flush(); +} +$db->sql_freeresult($result); + +echo 'FINISHED'; + +// Done +$db->sql_close(); + +?>
\ No newline at end of file |
