aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb
diff options
context:
space:
mode:
authorJakub Senko <jakubsenko@gmail.com>2018-07-26 15:42:44 +0200
committerJakub Senko <jakubsenko@gmail.com>2018-07-27 14:29:35 +0200
commit76982b430f8417c5930905f96ea42cd4c34ca6d7 (patch)
tree179bb5bc72ec2a5218227af3353dadd5d79525aa /phpBB/phpbb
parent911c46cc61cd64913283509602a2db9e7c86b914 (diff)
downloadforums-76982b430f8417c5930905f96ea42cd4c34ca6d7.tar
forums-76982b430f8417c5930905f96ea42cd4c34ca6d7.tar.gz
forums-76982b430f8417c5930905f96ea42cd4c34ca6d7.tar.bz2
forums-76982b430f8417c5930905f96ea42cd4c34ca6d7.tar.xz
forums-76982b430f8417c5930905f96ea42cd4c34ca6d7.zip
[ticket/11453] Improve performance of notification.method.messenger_base
PHPBB3-11453
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r--phpBB/phpbb/notification/method/messenger_base.php4
-rw-r--r--phpBB/phpbb/user_loader.php6
2 files changed, 6 insertions, 4 deletions
diff --git a/phpBB/phpbb/notification/method/messenger_base.php b/phpBB/phpbb/notification/method/messenger_base.php
index 32e79aa936..f82017b70e 100644
--- a/phpBB/phpbb/notification/method/messenger_base.php
+++ b/phpBB/phpbb/notification/method/messenger_base.php
@@ -87,7 +87,7 @@ abstract class messenger_base extends \phpbb\notification\method\base
$banned_users = phpbb_get_banned_user_ids($user_ids);
// Load all the users we need
- $this->user_loader->load_users($user_ids);
+ $this->user_loader->load_users(array_diff($user_ids, $banned_users), array(USER_IGNORE));
// Load the messenger
if (!class_exists('messenger'))
@@ -107,7 +107,7 @@ abstract class messenger_base extends \phpbb\notification\method\base
$user = $this->user_loader->get_user($notification->user_id);
- if ($user['user_type'] == USER_IGNORE || ($user['user_type'] == USER_INACTIVE && $user['user_inactive_reason'] == INACTIVE_MANUAL) || in_array($notification->user_id, $banned_users))
+ if ($user['user_type'] == USER_INACTIVE && $user['user_inactive_reason'] == INACTIVE_MANUAL)
{
continue;
}
diff --git a/phpBB/phpbb/user_loader.php b/phpBB/phpbb/user_loader.php
index 294f5208d5..9297450f3e 100644
--- a/phpBB/phpbb/user_loader.php
+++ b/phpBB/phpbb/user_loader.php
@@ -64,8 +64,9 @@ class user_loader
* Load user helper
*
* @param array $user_ids
+ * @param array $ignore_types user types to ignore
*/
- public function load_users(array $user_ids)
+ public function load_users(array $user_ids, array $ignore_types = array())
{
$user_ids[] = ANONYMOUS;
@@ -79,7 +80,8 @@ class user_loader
{
$sql = 'SELECT *
FROM ' . $this->users_table . '
- WHERE ' . $this->db->sql_in_set('user_id', $user_ids);
+ WHERE ' . $this->db->sql_in_set('user_id', $user_ids) . '
+ AND ' . $this->db->sql_in_set('user_type', $ignore_types, true, true);
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result))