aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorMáté Bartus <mate.bartus@gmail.com>2016-03-08 22:09:02 +0100
committerMáté Bartus <mate.bartus@gmail.com>2016-03-08 22:09:02 +0100
commit7c45ed0733d525d466ba6d45a13b50e5fc553126 (patch)
tree9ae9ffb35931b0060482f5a2b6fe2ed1b84446ac /phpBB
parenta0fa396901dfd7bea97b98570c6d6d5a51995392 (diff)
parent9fcd0b116b4a5340f8743df53235e1c639204989 (diff)
downloadforums-7c45ed0733d525d466ba6d45a13b50e5fc553126.tar
forums-7c45ed0733d525d466ba6d45a13b50e5fc553126.tar.gz
forums-7c45ed0733d525d466ba6d45a13b50e5fc553126.tar.bz2
forums-7c45ed0733d525d466ba6d45a13b50e5fc553126.tar.xz
forums-7c45ed0733d525d466ba6d45a13b50e5fc553126.zip
Merge pull request #4206 from marc1706/ticket/14519
[ticket/14519] Skip query if all unread notifications are retrieved
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 233d65eebe..222d9fe9e6 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