NEW: Limit the number of comments in the rss feed instead of returning all of them which can cause a performance issue when the number of comment is high

This commit is contained in:
Saophalkun Ponlu 2012-07-31 18:34:18 +12:00
parent bcd16e1c10
commit d74a331d7b
3 changed files with 5 additions and 0 deletions

View File

@ -29,6 +29,7 @@ class Commenting {
'show_comments_when_disabled' => false, // when comments are disabled should we show older comments (if available)
'order_comments_by' => "\"Created\" DESC",
'comments_per_page' => 10,
'rss_comments_per_page' => 10,
'comments_holder_id' => "comments-holder", // id for the comments holder
'comment_permalink_prefix' => "comment-", // id prefix for each comment. If needed make this different
'require_moderation' => false

View File

@ -102,6 +102,9 @@ class CommentingController extends Controller {
$comments = Comment::get();
}
$rssItemNum = Commenting::get_config_value($class ? $class : 'SiteTree', 'rss_comments_per_page');
if($rssItemNum) $comments = $comments->limit($rssItemNum);
$title = _t('CommentingController.RSSTITLE', "Comments RSS Feed");
$feed = new RSSFeed($comments, $link, $title, $link, 'Title', 'Comment', 'AuthorName');

View File

@ -11,6 +11,7 @@ The module provides a number of built in configuration settings below are the de
'show_comments_when_disabled' => false,
'order_comments_by' => "\"Created\" DESC",
'comments_per_page' => 10,
'rss_comments_per_page' => 10,
'comments_holder_id' => "comments-holder",
'comment_permalink_prefix' => "comment-",
'require_moderation' => false