mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/10897] Combine bot updates and bot delete.
PHPBB3-10897
This commit is contained in:
parent
54700f5ba2
commit
60ea1c10ef
1 changed files with 32 additions and 41 deletions
|
@ -2120,16 +2120,30 @@ function change_database_data(&$no_updates, $version)
|
||||||
AND module_mode = \'signature\'';
|
AND module_mode = \'signature\'';
|
||||||
_sql($sql, $errored, $error_ary);
|
_sql($sql, $errored, $error_ary);
|
||||||
|
|
||||||
// Update bot list
|
// Update bots
|
||||||
|
if (!function_exists('user_delete'))
|
||||||
|
{
|
||||||
|
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
|
||||||
|
}
|
||||||
|
|
||||||
|
$bots_updates = array(
|
||||||
|
// Bot Deletions
|
||||||
|
'NG-Search [Bot]' => false,
|
||||||
|
'Nutch/CVS [Bot]' => false,
|
||||||
|
'OmniExplorer [Bot]' => false,
|
||||||
|
'Seekport [Bot]' => false,
|
||||||
|
'Synoo [Bot]' => false,
|
||||||
|
'WiseNut [Bot]' => false,
|
||||||
|
|
||||||
|
// Bot Updates
|
||||||
// Bot name to bot user agent map
|
// Bot name to bot user agent map
|
||||||
$bots_to_update = array(
|
|
||||||
'Baidu [Spider]' => 'Baiduspider',
|
'Baidu [Spider]' => 'Baiduspider',
|
||||||
'Exabot [Bot]' => 'Exabot',
|
'Exabot [Bot]' => 'Exabot',
|
||||||
'Voyager [Bot]' => 'voyager/',
|
'Voyager [Bot]' => 'voyager/',
|
||||||
'W3C [Validator]' => 'W3C_Validator',
|
'W3C [Validator]' => 'W3C_Validator',
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($bots_to_update as $bot_name => $bot_agent)
|
foreach ($bots_updates as $bot_name => $bot_agent)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT user_id
|
$sql = 'SELECT user_id
|
||||||
FROM ' . USERS_TABLE . '
|
FROM ' . USERS_TABLE . '
|
||||||
|
@ -2141,38 +2155,7 @@ function change_database_data(&$no_updates, $version)
|
||||||
|
|
||||||
if ($bot_user_id)
|
if ($bot_user_id)
|
||||||
{
|
{
|
||||||
$sql = 'UPDATE ' . BOTS_TABLE . '
|
if ($bot_agent === false)
|
||||||
SET bot_agent = ' . $db->sql_escape($bot_agent) . "
|
|
||||||
WHERE user_id = $bot_user_id";
|
|
||||||
_sql($sql, $errored, $error_ary);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!function_exists('user_delete'))
|
|
||||||
{
|
|
||||||
include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
|
|
||||||
}
|
|
||||||
|
|
||||||
$bots_to_delete = array(
|
|
||||||
'NG-Search [Bot]',
|
|
||||||
'Nutch/CVS [Bot]',
|
|
||||||
'OmniExplorer [Bot]',
|
|
||||||
'Seekport [Bot]',
|
|
||||||
'Synoo [Bot]',
|
|
||||||
'WiseNut [Bot]',
|
|
||||||
);
|
|
||||||
|
|
||||||
foreach ($bots_to_delete as $bot_name)
|
|
||||||
{
|
|
||||||
$sql = 'SELECT user_id
|
|
||||||
FROM ' . USERS_TABLE . '
|
|
||||||
WHERE user_type = ' . USER_IGNORE . "
|
|
||||||
AND username_clean = '" . $db->sql_escape(utf8_clean_string($bot_name)) . "'";
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
$bot_user_id = (int) $db->sql_fetchfield('user_id');
|
|
||||||
$db->sql_freeresult($result);
|
|
||||||
|
|
||||||
if ($bot_user_id)
|
|
||||||
{
|
{
|
||||||
$sql = 'DELETE FROM ' . BOTS_TABLE . "
|
$sql = 'DELETE FROM ' . BOTS_TABLE . "
|
||||||
WHERE user_id = $bot_user_id";
|
WHERE user_id = $bot_user_id";
|
||||||
|
@ -2180,6 +2163,14 @@ function change_database_data(&$no_updates, $version)
|
||||||
|
|
||||||
user_delete('remove', $bot_user_id);
|
user_delete('remove', $bot_user_id);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sql = 'UPDATE ' . BOTS_TABLE . "
|
||||||
|
SET bot_agent = '" . $db->sql_escape($bot_agent) . "'
|
||||||
|
WHERE user_id = $bot_user_id";
|
||||||
|
_sql($sql, $errored, $error_ary);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$no_updates = false;
|
$no_updates = false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue