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
This commit is contained in:
Andreas Fischer 2009-12-17 00:12:51 +00:00
parent d5c16e4c8f
commit 6cc60ee8c2
2 changed files with 23 additions and 9 deletions

View file

@ -124,6 +124,7 @@
<li>[Change] Send time of last item instead of current time in ATOM Feeds. (Bug #53305)</li>
<li>[Change] Use em dash instead of hyphen/minus as separator in ATOM Feeds item statistics. (Bug #53565)</li>
<li>[Change] Alter ACP user quick tools interface to reduce confusion with the delete operation.</li>
<li>[Change] Remove item limit from &quot;All forums&quot; feed.</li>
</ul>
<a name="v305"></a><h3>1.ii. Changes since 3.0.5</h3>

View file

@ -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;