(minor) Make ApiFeedContributions respect $wgFeedLimit
authormrbluesky <mrbluesky@wikipedia.be>
Fri, 21 Dec 2012 22:40:45 +0000 (23:40 +0100)
committerBrian Wolff <bawolff+wn@gmail.com>
Mon, 2 Dec 2013 18:54:31 +0000 (14:54 -0400)
Change-Id: I67e6e30d9fa9b4998de720a2a444c7846003266e

includes/Pager.php
includes/api/ApiFeedContributions.php

index 4a14c7e..28d2839 100644 (file)
@@ -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
index 27037cb..bf69410 100644 (file)
@@ -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 ) {