diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2008-01-05 15:47:40 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2008-01-05 15:47:40 +0000 |
commit | 1074925720e84bcb9f2b1b6908da805c132a1c8a (patch) | |
tree | 2b458a55e5863920c95ef4e5e27db11a1ed0cb4a /phpBB/includes | |
parent | 8b423ba3084fbe29ce83aef2a5f6ac5380ee006e (diff) | |
download | forums-1074925720e84bcb9f2b1b6908da805c132a1c8a.tar forums-1074925720e84bcb9f2b1b6908da805c132a1c8a.tar.gz forums-1074925720e84bcb9f2b1b6908da805c132a1c8a.tar.bz2 forums-1074925720e84bcb9f2b1b6908da805c132a1c8a.tar.xz forums-1074925720e84bcb9f2b1b6908da805c132a1c8a.zip |
- backport viewforum performance change from 3.1.x to 3.0.x
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8305 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/mcp/mcp_forum.php | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php index d97fbb7107..e1820aa7ce 100644 --- a/phpBB/includes/mcp/mcp_forum.php +++ b/phpBB/includes/mcp/mcp_forum.php @@ -146,8 +146,8 @@ function mcp_forum_view($id, $mode, $action, $forum_info) $read_tracking_join = $read_tracking_select = ''; } - $sql = "SELECT t.*$read_tracking_select - FROM " . TOPICS_TABLE . " t $read_tracking_join + $sql = "SELECT t.topic_id + FROM " . TOPICS_TABLE . " t WHERE t.forum_id IN($forum_id, 0) " . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND t.topic_approved = 1') . " $limit_time_sql @@ -155,13 +155,24 @@ function mcp_forum_view($id, $mode, $action, $forum_info) $result = $db->sql_query_limit($sql, $topics_per_page, $start); $topic_list = $topic_tracking_info = array(); + while ($row = $db->sql_fetchrow($result)) { - $topic_rows[$row['topic_id']] = $row; $topic_list[] = $row['topic_id']; } $db->sql_freeresult($result); + $sql = "SELECT t.*$read_tracking_select + FROM " . TOPICS_TABLE . " t $read_tracking_join + WHERE " . $db->sql_in_set('t.topic_id', $topic_list); + + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) + { + $topic_rows[$row['topic_id']] = $row; + } + $db->sql_freeresult($result); + // If there is more than one page, but we have no topic list, then the start parameter is... erm... out of sync if (!sizeof($topic_list) && $forum_topics && $start > 0) { @@ -181,10 +192,12 @@ function mcp_forum_view($id, $mode, $action, $forum_info) } } - foreach ($topic_rows as $topic_id => $row) + foreach ($topic_list as $topic_id) { $topic_title = ''; + $row = &$topic_rows[$topic_id]; + $replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies']; if ($row['topic_status'] == ITEM_MOVED) |