From a00cee7cc86ea935f13dd85f5a301646670c5ca9 Mon Sep 17 00:00:00 2001 From: mrbluesky Date: Fri, 21 Dec 2012 23:40:45 +0100 Subject: [PATCH] (minor) Make ApiFeedContributions respect $wgFeedLimit Change-Id: I67e6e30d9fa9b4998de720a2a444c7846003266e --- includes/Pager.php | 9 +++++++++ includes/api/ApiFeedContributions.php | 6 +++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/includes/Pager.php b/includes/Pager.php index 4a14c7e065..28d2839057 100644 --- a/includes/Pager.php +++ b/includes/Pager.php @@ -267,6 +267,15 @@ abstract class IndexPager extends ContextSource implements Pager { } } + /** + * Get the current limit + * + * @return int + */ + function getLimit() { + return $this->mLimit; + } + /** * Set whether a row matching exactly the offset should be also included * in the result or not. By default this is not the case, but when the diff --git a/includes/api/ApiFeedContributions.php b/includes/api/ApiFeedContributions.php index 27037cba47..bf69410356 100644 --- a/includes/api/ApiFeedContributions.php +++ b/includes/api/ApiFeedContributions.php @@ -41,7 +41,7 @@ class ApiFeedContributions extends ApiBase { public function execute() { $params = $this->extractRequestParams(); - global $wgFeed, $wgFeedClasses, $wgSitename, $wgLanguageCode; + global $wgFeed, $wgFeedClasses, $wgFeedLimit, $wgSitename, $wgLanguageCode; if ( !$wgFeed ) { $this->dieUsage( 'Syndication feeds are not available', 'feed-unavailable' ); @@ -81,6 +81,10 @@ class ApiFeedContributions extends ApiBase { 'showSizeDiff' => $params['showsizediff'], ) ); + if ( $pager->getLimit() > $wgFeedLimit ) { + $pager->setLimit( $wgFeedLimit ); + } + $feedItems = array(); if ( $pager->getNumRows() > 0 ) { foreach ( $pager->mResult as $row ) { -- 2.20.1