remove user with empty username_clean...

git-svn-id: file:///svn/phpbb/trunk@7180 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2007-03-12 21:43:07 +00:00
parent 1b689a884d
commit 15b2933fd9
3 changed files with 32 additions and 2 deletions

View file

@ -2002,6 +2002,32 @@ function fix_empty_primary_groups()
$db->sql_freeresult($result);
}
/**
* Cleanly remove invalid user entries after converting the users table...
*/
function remove_invalid_users()
{
global $convert, $db;
// username_clean is UNIQUE
$sql = 'SELECT user_id
FROM ' . USERS_TABLE . "
WHERE username_clean = ''";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if ($row)
{
if (!function_exists('user_delete'))
{
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
}
user_delete('remove', $row['user_id']);
}
}
function convert_bbcode($message, $convert_size = true, $extended_bbcodes = false)
{
static $orig, $repl, $origx, $replx, $str_from, $str_to;

View file

@ -821,7 +821,11 @@ if (!$get_info)
array('target', 'DELETE FROM ' . USERS_TABLE . ' WHERE user_id <> ' . ANONYMOUS),
array('target', $convert->truncate_statement . BOTS_TABLE)
),
'execute_last' => '
remove_invalid_users();
',
array('user_id', 'users.user_id', 'phpbb_user_id'),
array('', 'users.user_id AS poster_id', 'phpbb_user_id'),
array('user_type', 'users.user_active', 'set_user_type'),

View file

@ -1669,7 +1669,7 @@ class install_install extends module
if (!function_exists('user_add'))
{
include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
}
foreach ($this->bot_list as $bot_name => $bot_ary)