aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/install
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2012-11-16 14:32:31 +0100
committerJoas Schilling <nickvergessen@gmx.de>2012-12-01 10:54:26 +0100
commitad2d560f3f6ab0232728392b2c1c946f2b07902d (patch)
tree788e78b718196ec9ac20255dd81157dd79e8bfa2 /phpBB/install
parent314462d8352a6b5ea1fd27ce1bb21cb0a8fb1310 (diff)
downloadforums-ad2d560f3f6ab0232728392b2c1c946f2b07902d.tar
forums-ad2d560f3f6ab0232728392b2c1c946f2b07902d.tar.gz
forums-ad2d560f3f6ab0232728392b2c1c946f2b07902d.tar.bz2
forums-ad2d560f3f6ab0232728392b2c1c946f2b07902d.tar.xz
forums-ad2d560f3f6ab0232728392b2c1c946f2b07902d.zip
[ticket/10184] Query bots table to get the user_ids of the bots
PHPBB3-10184
Diffstat (limited to 'phpBB/install')
-rw-r--r--phpBB/install/database_update.php22
1 files changed, 18 insertions, 4 deletions
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index 8e23434b5b..983b1b46c4 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -2172,10 +2172,24 @@ function change_database_data(&$no_updates, $version)
}
// Disable receiving pms for bots
- $sql = 'UPDATE ' . USERS_TABLE . '
- SET user_allow_pm = 0
- WHERE user_type = ' . USER_IGNORE;
- $db->sql_query($sql);
+ $sql = 'SELECT user_id
+ FROM ' . BOTS_TABLE;
+ $result = $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;
break;