diff options
| author | David M <davidmj@users.sourceforge.net> | 2008-01-04 18:35:49 +0000 |
|---|---|---|
| committer | David M <davidmj@users.sourceforge.net> | 2008-01-04 18:35:49 +0000 |
| commit | af738dbc2a48713f59779410955282aa5760b741 (patch) | |
| tree | 35053fbc840e81689dada401b978ae8dfb181d33 /phpBB/viewforum.php | |
| parent | edd6c34eda14fbef5bd1e6502735c45d038d6575 (diff) | |
| download | forums-af738dbc2a48713f59779410955282aa5760b741.tar forums-af738dbc2a48713f59779410955282aa5760b741.tar.gz forums-af738dbc2a48713f59779410955282aa5760b741.tar.bz2 forums-af738dbc2a48713f59779410955282aa5760b741.tar.xz forums-af738dbc2a48713f59779410955282aa5760b741.zip | |
Ch-ch-ch-changes
- Made us more DB independent by making many queries capability based instead of DB specific
- Finished PHP5ifying of the acm_file class, now with some (hopefully) enhancements to its performance
- Sped up viewforum considerably (also goes towards mcp_forum)
I really hope I didn't explode CVS...
git-svn-id: file:///svn/phpbb/trunk@8301 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/viewforum.php')
| -rw-r--r-- | phpBB/viewforum.php | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 5a618f4a2c..cb9b125400 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -405,28 +405,38 @@ else if (empty($active_forum_ary['exclude_forum_id'])) else { $get_forum_ids = array_diff($active_forum_ary['forum_id'], $active_forum_ary['exclude_forum_id']); - $sql_where = (sizeof($get_forum_ids)) ? $db->sql_in_set('t.forum_id', $get_forum_ids) : 't.forum_id = ' . $forum_id; + $sql_where = $db->sql_in_set('t.forum_id', $get_forum_ids); } +// Grab just the sorted topic ids +$sql = 'SELECT t.topic_id + FROM ' . TOPICS_TABLE . " t + WHERE $sql_where + AND t.topic_type IN (" . POST_NORMAL . ', ' . POST_STICKY . ") + $sql_approved + $sql_limit_time + ORDER BY t.topic_type " . ((!$store_reverse) ? 'DESC' : 'ASC') . ', ' . $sql_sort_order; +$result = $db->sql_query_limit($sql, $sql_limit, $sql_start); +while ($row = $db->sql_fetchrow($result)) +{ + $topic_list[] = (int) $row['topic_id']; +} +$db->sql_freeresult($result); + // SQL array for obtaining topics/stickies $sql_array = array( 'SELECT' => $sql_array['SELECT'], 'FROM' => $sql_array['FROM'], 'LEFT_JOIN' => $sql_array['LEFT_JOIN'], - 'WHERE' => $sql_where . ' - AND t.topic_type IN (' . POST_NORMAL . ', ' . POST_STICKY . ") - $sql_approved - $sql_limit_time", - - 'ORDER_BY' => 't.topic_type ' . ((!$store_reverse) ? 'DESC' : 'ASC') . ', ' . $sql_sort_order, + 'WHERE' => $db->sql_in_set('t.topic_id', $topic_list), ); // If store_reverse, then first obtain topics, then stickies, else the other way around... // Funnily enough you typically save one query if going from the last page to the middle (store_reverse) because // the number of stickies are not known $sql = $db->sql_build_query('SELECT', $sql_array); -$result = $db->sql_query_limit($sql, $sql_limit, $sql_start); +$result = $db->sql_query($sql); $shadow_topic_list = array(); while ($row = $db->sql_fetchrow($result)) @@ -437,7 +447,6 @@ while ($row = $db->sql_fetchrow($result)) } $rowset[$row['topic_id']] = $row; - $topic_list[] = $row['topic_id']; } $db->sql_freeresult($result); |
