Merge "Fixed api.php fatals due to protected field usage"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 2 Dec 2013 18:58:20 +0000 (18:58 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 2 Dec 2013 18:58:20 +0000 (18:58 +0000)
includes/Pager.php
includes/api/ApiFeedContributions.php
includes/filerepo/LocalRepo.php
includes/filerepo/file/LocalFile.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 ) {
index a410eed..965f677 100644 (file)
  * @ingroup FileRepo
  */
 class LocalRepo extends FileRepo {
-       public $oldFileFromRowFactory = array( 'OldLocalFile', 'newFromRow' );
-
        protected $fileFactory = array( 'LocalFile', 'newFromTitle' );
        protected $fileFactoryKey = array( 'LocalFile', 'newFromKey' );
        protected $fileFromRowFactory = array( 'LocalFile', 'newFromRow' );
+       protected $oldFileFromRowFactory = array( 'OldLocalFile', 'newFromRow' );
        protected $oldFileFactory = array( 'OldLocalFile', 'newFromTitle' );
        protected $oldFileFactoryKey = array( 'OldLocalFile', 'newFromKey' );
 
index 3c15449..c6ea79f 100644 (file)
@@ -994,11 +994,7 @@ class LocalFile extends File {
                $r = array();
 
                foreach ( $res as $row ) {
-                       if ( $this->repo->oldFileFromRowFactory ) {
-                               $r[] = call_user_func( $this->repo->oldFileFromRowFactory, $row, $this->repo );
-                       } else {
-                               $r[] = OldLocalFile::newFromRow( $row, $this->repo );
-                       }
+                       $r[] = $this->repo->newFileFromRow( $row );
                }
 
                if ( $order == 'ASC' ) {