mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-26 03:48:53 +00:00
[ticket/10897] Use same code/query for deleting.
PHPBB3-10897
This commit is contained in:
parent
520ffdf368
commit
54700f5ba2
1 changed files with 6 additions and 9 deletions
|
@ -2164,21 +2164,18 @@ function change_database_data(&$no_updates, $version)
|
||||||
|
|
||||||
foreach ($bots_to_delete as $bot_name)
|
foreach ($bots_to_delete as $bot_name)
|
||||||
{
|
{
|
||||||
$bot_name_clean = utf8_clean_string($bot_name);
|
|
||||||
|
|
||||||
$sql = 'SELECT user_id
|
$sql = 'SELECT user_id
|
||||||
FROM ' . USERS_TABLE . "
|
FROM ' . USERS_TABLE . '
|
||||||
WHERE username_clean = '" . $db->sql_escape($bot_name_clean) . "'";
|
WHERE user_type = ' . USER_IGNORE . "
|
||||||
|
AND username_clean = '" . $db->sql_escape(utf8_clean_string($bot_name)) . "'";
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$bot_user_id = $db->sql_fetchfield('user_id');
|
$bot_user_id = (int) $db->sql_fetchfield('user_id');
|
||||||
$is_user = (bool) $bot_user_id;
|
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
if ($is_user)
|
if ($bot_user_id)
|
||||||
{
|
{
|
||||||
$sql = 'DELETE FROM ' . BOTS_TABLE . "
|
$sql = 'DELETE FROM ' . BOTS_TABLE . "
|
||||||
WHERE bot_name = '" . $db->sql_escape($bot_name) . "'";
|
WHERE user_id = $bot_user_id";
|
||||||
|
|
||||||
_sql($sql, $errored, $error_ary);
|
_sql($sql, $errored, $error_ary);
|
||||||
|
|
||||||
user_delete('remove', $bot_user_id);
|
user_delete('remove', $bot_user_id);
|
||||||
|
|
Loading…
Add table
Reference in a new issue