Merge "(follow-up) Fix "file not found" error in mediawiki.language."
[lhc/web/wiklou.git] / includes / api / ApiFeedContributions.php
index c1e968e..d808075 100644 (file)
@@ -1,5 +1,4 @@
 <?php
-
 /**
  *
  *
@@ -36,6 +35,8 @@ class ApiFeedContributions extends ApiBase {
 
        /**
         * This module uses a custom feed wrapper printer.
+        *
+        * @return ApiFormatFeedWrapper
         */
        public function getCustomPrinter() {
                return new ApiFormatFeedWrapper( $this->getMain() );
@@ -54,6 +55,11 @@ class ApiFeedContributions extends ApiBase {
                        $this->dieUsage( 'Invalid subscription feed type', 'feed-invalid' );
                }
 
+               global $wgMiserMode;
+               if ( $params['showsizediff'] && $wgMiserMode ) {
+                       $this->dieUsage( 'Size difference is disabled in Miser Mode', 'sizediffdisabled' );
+               }
+
                $msg = wfMsgForContent( 'Contributions' );
                $feedTitle = $wgSitename . ' - ' . $msg . ' [' . $wgLanguageCode . ']';
                $feedUrl = SpecialPage::getTitleFor( 'Contributions', $params['user'] )->getFullURL();
@@ -68,7 +74,7 @@ class ApiFeedContributions extends ApiBase {
                        $feedUrl
                );
 
-               $pager = new ContribsPager( array(
+               $pager = new ContribsPager( $this->getContext(), array(
                        'target' => $target,
                        'namespace' => $params['namespace'],
                        'year' => $params['year'],
@@ -90,11 +96,11 @@ class ApiFeedContributions extends ApiBase {
        }
 
        protected function feedItem( $row ) {
-               $title = Title::MakeTitle( intval( $row->page_namespace ), $row->page_title );
+               $title = Title::makeTitle( intval( $row->page_namespace ), $row->page_title );
                if( $title ) {
                        $date = $row->rev_timestamp;
                        $comments = $title->getTalkPage()->getFullURL();
-                       $revision = Revision::newFromTitle( $title, $row->rev_id );
+                       $revision = Revision::newFromRow( $row );
 
                        return new FeedItem(
                                $title->getPrefixedText(),
@@ -144,8 +150,7 @@ class ApiFeedContributions extends ApiBase {
                                ApiBase::PARAM_REQUIRED => true,
                        ),
                        'namespace' => array(
-                               ApiBase::PARAM_TYPE => 'namespace',
-                               ApiBase::PARAM_ISMULTI => true
+                               ApiBase::PARAM_TYPE => 'namespace'
                        ),
                        'year' => array(
                                ApiBase::PARAM_TYPE => 'integer'
@@ -174,7 +179,7 @@ class ApiFeedContributions extends ApiBase {
                        'tagfilter' => 'Filter contributions that have these tags',
                        'deletedonly' => 'Show only deleted contributions',
                        'toponly' => 'Only show edits that are latest revisions',
-                       'showsizediff' => '',
+                       'showsizediff' => 'Show the size difference between revisions. Disabled in Miser Mode',
                );
        }
 
@@ -186,10 +191,11 @@ class ApiFeedContributions extends ApiBase {
                return array_merge( parent::getPossibleErrors(), array(
                        array( 'code' => 'feed-unavailable', 'info' => 'Syndication feeds are not available' ),
                        array( 'code' => 'feed-invalid', 'info' => 'Invalid subscription feed type' ),
+                       array( 'code' => 'sizediffdisabled', 'info' => 'Size difference is disabled in Miser Mode' ),
                ) );
        }
 
-       protected function getExamples() {
+       public function getExamples() {
                return array(
                        'api.php?action=feedcontributions&user=Reedy',
                );
@@ -198,4 +204,4 @@ class ApiFeedContributions extends ApiBase {
        public function getVersion() {
                return __CLASS__ . ': $Id$';
        }
-}
\ No newline at end of file
+}