mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 22:10:45 +02:00
- some fixes
- added script for easy adjustement of username_clean column within the users table (please see the note i added to the utf8_clean_string() function) git-svn-id: file:///svn/phpbb/trunk@6561 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
52
phpBB/develop/adjust_usernames.php
Normal file
52
phpBB/develop/adjust_usernames.php
Normal file
@@ -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();
|
||||
|
||||
?>
|
Reference in New Issue
Block a user