From c6070d6dac90df81f4ec6a00ba74b087cccbb5ed Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Thu, 19 Mar 2009 13:25:00 +0000 Subject: small SQL optimization git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9395 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/search.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index 965c1a3c4b..2defd4bb92 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -395,7 +395,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) while ($row = $db->sql_fetchrow($result)) { - $id_ary[] = $row[$field]; + $id_ary[] = (int) $row[$field]; } $db->sql_freeresult($result); -- cgit v1.2.1 From ac9e1472891fe9d69e1660985841f2f8fbb797f8 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Fri, 17 Apr 2009 15:08:09 +0000 Subject: Apply append_sid() to newest/latest post links in viewforum/search and UCP main module. (Bug #26815) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9459 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/search.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index 2defd4bb92..7c21b8dd01 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -767,7 +767,8 @@ if ($keywords || $author || $author_id || $search_id || $submit) $u_forum_id = $forum_id; } - $view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$u_forum_id&t=$result_topic_id" . (($u_hilit) ? "&hilit=$u_hilit" : '')); + $view_topic_url_params = "f=$u_forum_id&t=$result_topic_id" . (($u_hilit) ? "&hilit=$u_hilit" : ''); + $view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params); $replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies']; @@ -825,10 +826,10 @@ if ($keywords || $author || $author_id || $search_id || $submit) 'S_TOPIC_UNAPPROVED' => $topic_unapproved, 'S_POSTS_UNAPPROVED' => $posts_unapproved, - 'U_LAST_POST' => $view_topic_url . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'], + 'U_LAST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&p=' . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'], 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'U_TOPIC_AUTHOR' => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), - 'U_NEWEST_POST' => $view_topic_url . '&view=unread#unread', + 'U_NEWEST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&view=unread') . '#unread', 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=reports&t=' . $result_topic_id, true, $user->session_id), 'U_MCP_QUEUE' => $u_mcp_queue, ); -- cgit v1.2.1 From f6bb6dda3f3ab856cd77f06dab649697e695292e Mon Sep 17 00:00:00 2001 From: Jim Wigginton Date: Fri, 24 Apr 2009 17:27:10 +0000 Subject: Fixed bug #'ers 42585, 35505, 36675, and 42705 Authorised by: acydburn git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9482 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/search.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index 7c21b8dd01..7192127e5a 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -365,13 +365,14 @@ if ($keywords || $author || $author_id || $search_id || $submit) } else { - $sql = 'SELECT t.topic_id - FROM ' . TOPICS_TABLE . ' t - WHERE t.topic_last_post_time > ' . $user->data['user_lastvisit'] . ' - AND t.topic_moved_id = 0 - ' . str_replace(array('p.', 'post_'), array('t.', 'topic_'), $m_approve_fid_sql) . ' - ' . ((sizeof($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '') . " - $sql_sort"; + $sql = 'SELECT t.topic_id + FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p + WHERE p.post_time > ' . $user->data['user_lastvisit'] . ' + AND t.topic_id = p.topic_id + AND t.topic_moved_id = 0 + ' . $m_approve_fid_sql . ' + ' . ((sizeof($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '') . " + $sql_sort"; $field = 'topic_id'; } break; -- cgit v1.2.1 From a15276a66a7e12ef9f53e5d836fd066f718fdc93 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 26 Apr 2009 14:53:05 +0000 Subject: revert query change which caused boards to halt. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9486 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/search.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index 7192127e5a..80ad756329 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -365,14 +365,23 @@ if ($keywords || $author || $author_id || $search_id || $submit) } else { - $sql = 'SELECT t.topic_id + $sql = 'SELECT t.topic_id + FROM ' . TOPICS_TABLE . ' t + WHERE t.topic_last_post_time > ' . $user->data['user_lastvisit'] . ' + AND t.topic_moved_id = 0 + ' . str_replace(array('p.', 'post_'), array('t.', 'topic_'), $m_approve_fid_sql) . ' + ' . ((sizeof($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '') . " + $sql_sort"; +/* + $sql = 'SELECT t.topic_id FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p WHERE p.post_time > ' . $user->data['user_lastvisit'] . ' AND t.topic_id = p.topic_id - AND t.topic_moved_id = 0 + AND t.topic_moved_id = 0 ' . $m_approve_fid_sql . ' - ' . ((sizeof($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '') . " - $sql_sort"; + ' . ((sizeof($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '') . " + $sql_sort"; +*/ $field = 'topic_id'; } break; -- cgit v1.2.1 From 5ad7caebc8e0ab08c2d0464d0a561dd562fc5202 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 26 Apr 2009 15:11:32 +0000 Subject: group by is required to be correct, but this creates a temporary table. I do not think we will let "new posts" display non-approved posts... git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9487 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/search.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index 80ad756329..6189c359bd 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -378,8 +378,9 @@ if ($keywords || $author || $author_id || $search_id || $submit) WHERE p.post_time > ' . $user->data['user_lastvisit'] . ' AND t.topic_id = p.topic_id AND t.topic_moved_id = 0 - ' . $m_approve_fid_sql . ' + ' . $m_approve_fid_sql . ' ' . ((sizeof($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '') . " + GROUP BY t.topic_id $sql_sort"; */ $field = 'topic_id'; -- cgit v1.2.1 From 422e472936b8a7af6404f4e70e344f469a91a899 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 26 Apr 2009 15:12:54 +0000 Subject: remove item from change log git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9488 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/search.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'phpBB/search.php') diff --git a/phpBB/search.php b/phpBB/search.php index 6189c359bd..cf2e8615c2 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -373,6 +373,9 @@ if ($keywords || $author || $author_id || $search_id || $submit) ' . ((sizeof($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '') . " $sql_sort"; /* + [Fix] queued replies missing from "view new posts" (Bug #42705 - Patch by Paul) + - Creates temporary table, query is far from optimized + $sql = 'SELECT t.topic_id FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p WHERE p.post_time > ' . $user->data['user_lastvisit'] . ' -- cgit v1.2.1