aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2016-03-08 12:15:21 +0100
committerMarc Alexander <admin@m-a-styles.de>2016-03-08 12:15:21 +0100
commit9fcd0b116b4a5340f8743df53235e1c639204989 (patch)
tree2eaec735454ecca390b82bdbda634e9cfb8771a7 /phpBB
parentf55a61d067fbc6c36348c3203e965d54b02198fd (diff)
downloadforums-9fcd0b116b4a5340f8743df53235e1c639204989.tar
forums-9fcd0b116b4a5340f8743df53235e1c639204989.tar.gz
forums-9fcd0b116b4a5340f8743df53235e1c639204989.tar.bz2
forums-9fcd0b116b4a5340f8743df53235e1c639204989.tar.xz
forums-9fcd0b116b4a5340f8743df53235e1c639204989.zip
[ticket/14519] Skip query if all unread notifications are retrieved
PHPBB3-14519
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/phpbb/notification/manager.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/phpBB/phpbb/notification/manager.php b/phpBB/phpbb/notification/manager.php
index db92170dd8..b1b096d41d 100644
--- a/phpBB/phpbb/notification/manager.php
+++ b/phpBB/phpbb/notification/manager.php
@@ -186,6 +186,7 @@ class manager
if (!$options['count_total'] || $total_count)
{
$rowset = array();
+ $selected_unread_count = 0;
// Get the main notifications
$sql = 'SELECT n.*, nt.notification_type_name
@@ -200,11 +201,12 @@ class manager
while ($row = $this->db->sql_fetchrow($result))
{
$rowset[$row['notification_id']] = $row;
+ $selected_unread_count += (int) !$row['notification_read'];
}
$this->db->sql_freeresult($result);
// Get all unread notifications
- if ($unread_count && $options['all_unread'] && !empty($rowset))
+ if ($selected_unread_count < $unread_count && $options['all_unread'] && !empty($rowset))
{
$sql = 'SELECT n.*, nt.notification_type_name
FROM ' . $this->notifications_table . ' n, ' . $this->notification_types_table . ' nt