From 6cc60ee8c23fdd1f9b9ff9df81ed0a7f05ce1d2f Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 17 Dec 2009 00:12:51 +0000 Subject: [PATCH] Improve 'All forums' feed: Remove limit, display all forums. Join all queries to one. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10344 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/feed.php | 31 ++++++++++++++++++++++--------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index c6bb7e2243..4706877eae 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -124,6 +124,7 @@
  • [Change] Send time of last item instead of current time in ATOM Feeds. (Bug #53305)
  • [Change] Use em dash instead of hyphen/minus as separator in ATOM Feeds item statistics. (Bug #53565)
  • [Change] Alter ACP user quick tools interface to reduce confusion with the delete operation.
  • +
  • [Change] Remove item limit from "All forums" feed.
  • 1.ii. Changes since 3.0.5

    diff --git a/phpBB/feed.php b/phpBB/feed.php index ffaeaa5bf1..2036d0ea00 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -892,35 +892,48 @@ class phpbb_feed extends phpbb_feed_base } } +/** +* 'All Forums' feed +* +* This will give you a list of all postable forums where feeds are enabled +* including forum description, topic stats and post stats +* +* @package phpBB3 +*/ class phpbb_feed_forums extends phpbb_feed_base { + var $num_items = 0; + function set_keys() { - global $config; - $this->set('title', 'forum_name'); $this->set('text', 'forum_desc'); $this->set('bitfield', 'forum_desc_bitfield'); $this->set('bbcode_uid','forum_desc_uid'); $this->set('date', 'forum_last_post_time'); $this->set('options', 'forum_desc_options'); - - $this->num_items = (int) $config['feed_overall_forums_limit']; } function get_sql() { - global $db; + global $auth, $db; - $not_in_fid = (sizeof($this->excluded_forums())) ? ' AND ' . $db->sql_in_set('f.forum_id', $this->excluded_forums(), true) : ''; + $f_read_ids = array_keys($auth->acl_getf('f_read')); + if (empty($f_read_ids)) + { + return false; + } // Build SQL Query $this->sql = array( - 'SELECT' => 'f.*', + 'SELECT' => 'f.forum_id, f.left_id, f.forum_name, f.forum_last_post_time, + f.forum_desc, f.forum_desc_bitfield, f.forum_desc_uid, f.forum_desc_options, + f.forum_topics, f.forum_posts', 'FROM' => array(FORUMS_TABLE => 'f'), 'WHERE' => 'f.forum_type = ' . FORUM_POST . ' - AND (f.forum_last_post_id > 0' . $not_in_fid . ')', - 'ORDER_BY' => 'f.left_id', + AND ' . $db->sql_bit_and('f.forum_options', FORUM_OPTION_FEED_EXCLUDE, '= 0') . ' + AND ' . $db->sql_in_set('f.forum_id', $f_read_ids), + 'ORDER_BY' => 'f.left_id ASC', ); return true;