aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2011-01-23 18:35:10 +0100
committerNils Adermann <naderman@naderman.de>2011-01-23 18:35:10 +0100
commit1196b96462e519271d01bc1821aafc35aafc0fd8 (patch)
treeaef22a9f0d0e995cb82504d768e1140112b048a4
parent40cf8b1c0ab0a14f4c2a6e8059de6d648f8d4536 (diff)
parent42294907250e3e13c51e73c80aa7edbf2a8ec2ed (diff)
downloadforums-1196b96462e519271d01bc1821aafc35aafc0fd8.tar
forums-1196b96462e519271d01bc1821aafc35aafc0fd8.tar.gz
forums-1196b96462e519271d01bc1821aafc35aafc0fd8.tar.bz2
forums-1196b96462e519271d01bc1821aafc35aafc0fd8.tar.xz
forums-1196b96462e519271d01bc1821aafc35aafc0fd8.zip
Merge branch 'develop-olympus' into develop
* develop-olympus: [ticket/8779] Slow search for 'View unread posts'
-rw-r--r--phpBB/includes/functions.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 06de40a764..c4be5330bd 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -1518,7 +1518,7 @@ function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $s
if ($config['load_db_lastread'] && $user->data['is_registered'])
{
// Get list of the unread topics
- $last_mark = $user->data['user_lastmark'];
+ $last_mark = (int) $user->data['user_lastmark'];
$sql_array = array(
'SELECT' => 't.topic_id, t.topic_last_post_time, tt.mark_time as topic_mark_time, ft.mark_time as forum_mark_time',
@@ -1537,10 +1537,11 @@ function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $s
),
'WHERE' => "
+ t.topic_last_post_time > $last_mark AND
(
(tt.mark_time IS NOT NULL AND t.topic_last_post_time > tt.mark_time) OR
(tt.mark_time IS NULL AND ft.mark_time IS NOT NULL AND t.topic_last_post_time > ft.mark_time) OR
- (tt.mark_time IS NULL AND ft.mark_time IS NULL AND t.topic_last_post_time > $last_mark)
+ (tt.mark_time IS NULL AND ft.mark_time IS NULL)
)
$sql_extra
$sql_sort",