Brian Wolff has submitted this change and it was merged.

Change subject: (minor) Make ApiFeedContributions respect $wgFeedLimit
......................................................................


(minor) Make ApiFeedContributions respect $wgFeedLimit

Change-Id: I67e6e30d9fa9b4998de720a2a444c7846003266e
---
M includes/Pager.php
M includes/api/ApiFeedContributions.php
2 files changed, 14 insertions(+), 1 deletion(-)

Approvals:
  Brian Wolff: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/Pager.php b/includes/Pager.php
index 4a14c7e..28d2839 100644
--- a/includes/Pager.php
+++ b/includes/Pager.php
@@ -268,6 +268,15 @@
        }
 
        /**
+        * 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
         * offset is user-supplied this might be wanted.
diff --git a/includes/api/ApiFeedContributions.php 
b/includes/api/ApiFeedContributions.php
index 27037cb..bf69410 100644
--- a/includes/api/ApiFeedContributions.php
+++ b/includes/api/ApiFeedContributions.php
@@ -41,7 +41,7 @@
        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 @@
                        'showSizeDiff' => $params['showsizediff'],
                ) );
 
+               if ( $pager->getLimit() > $wgFeedLimit ) {
+                       $pager->setLimit( $wgFeedLimit );
+               }
+
                $feedItems = array();
                if ( $pager->getNumRows() > 0 ) {
                        foreach ( $pager->mResult as $row ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/39840
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I67e6e30d9fa9b4998de720a2a444c7846003266e
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MrBlueSky <mrblue...@wikipedia.be>
Gerrit-Reviewer: Anomie <bjor...@wikimedia.org>
Gerrit-Reviewer: Brian Wolff <bawolff...@gmail.com>
Gerrit-Reviewer: Catrope <roan.katt...@gmail.com>
Gerrit-Reviewer: Lwelling <lwell...@wikimedia.org>
Gerrit-Reviewer: Yurik <yu...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to