diff options
author | Dries Buytaert <dries@buytaert.net> | 2004-11-04 21:05:06 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2004-11-04 21:05:06 +0000 |
commit | b3e3f8ae373c47fae44156d86fc481fcb196c17b (patch) | |
tree | 99b3f081a18aa03e3644e4e28a56d91178b7664b /modules/forum.module | |
parent | 14353d18ad4682ed6f1e3ab554ef85c42a2bafee (diff) | |
download | brdo-b3e3f8ae373c47fae44156d86fc481fcb196c17b.tar.gz brdo-b3e3f8ae373c47fae44156d86fc481fcb196c17b.tar.bz2 |
- Updated forum_block() to pass comment_count's to node_title_list(). This eliminates up to 10 SQL queries (sometimes less) for each non-cached page view on drupal.org. Derived from ccourtne's patch.
Diffstat (limited to 'modules/forum.module')
-rw-r--r-- | modules/forum.module | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/forum.module b/modules/forum.module index b96d5da4b..e116cb34c 100644 --- a/modules/forum.module +++ b/modules/forum.module @@ -127,9 +127,9 @@ function forum_block($op = 'list', $delta = 0, $edit = array()) { case 'view': if (user_access('access content')) { - $content = node_title_list(db_query_range("SELECT n.nid, n.title, l.last_comment_timestamp FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid ". node_access_join_sql() ." WHERE n.status = 1 AND n.type='forum' AND ". node_access_where_sql() ." ORDER BY l.last_comment_timestamp DESC", 0, variable_get('forum_block_num', '5')), t('Active forum topics:')); + $content = node_title_list(db_query_range("SELECT n.nid, n.title, l.last_comment_timestamp, l.comment_count FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid ". node_access_join_sql() ." WHERE n.status = 1 AND n.type='forum' AND ". node_access_where_sql() ." ORDER BY l.last_comment_timestamp DESC", 0, variable_get('forum_block_num', '5')), t('Active forum topics:')); - $content .= node_title_list(db_query_range("SELECT n.nid, n.title FROM {node} n ". node_access_join_sql() ." WHERE n.type = 'forum' AND n.status = 1 AND ". node_access_where_sql() ." ORDER BY n.nid DESC", 0, variable_get('forum_block_num', '5')), t('New forum topics:')); + $content .= node_title_list(db_query_range("SELECT n.nid, n.title, l.comment_count FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid ". node_access_join_sql() ." WHERE n.type = 'forum' AND n.status = 1 AND ". node_access_where_sql() ." ORDER BY n.nid DESC", 0, variable_get('forum_block_num', '5')), t('New forum topics:')); if ($content) { $content .= '<div class="more-link">'. l(t('more'), 'forum', array('title' => t('Read the latest forum topics.'))) .'</div>'; |