[ticket/10184] Query bots table to get the user_ids of the bots

PHPBB3-10184
This commit is contained in:
Joas Schilling 2012-11-16 14:32:31 +01:00
parent 314462d835
commit ad2d560f3f

View file

@ -2172,10 +2172,24 @@ function change_database_data(&$no_updates, $version)
} }
// Disable receiving pms for bots // Disable receiving pms for bots
$sql = 'UPDATE ' . USERS_TABLE . ' $sql = 'SELECT user_id
SET user_allow_pm = 0 FROM ' . BOTS_TABLE;
WHERE user_type = ' . USER_IGNORE; $result = $db->sql_query($sql);
$db->sql_query($sql);
$bot_user_ids = array();
while ($row = $db->sql_fetchrow($result))
{
$bot_user_ids[] = (int) $row['user_id'];
}
$db->sql_freeresult($result);
if (!empty($bot_user_ids))
{
$sql = 'UPDATE ' . USERS_TABLE . '
SET user_allow_pm = 0
WHERE ' . $db->sql_in_set('user_id', $bot_user_ids);
_sql($sql, $errored, $error_ary);
}
$no_updates = false; $no_updates = false;
break; break;