From ca32f08966f1b51fcb19460f0996bb0c4048e6fe Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 3 Dec 2011 13:29:22 +0100 Subject: Update to MediaWiki 1.18.0 * also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing --- includes/api/ApiFeedWatchlist.php | 41 +++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) (limited to 'includes/api/ApiFeedWatchlist.php') diff --git a/includes/api/ApiFeedWatchlist.php b/includes/api/ApiFeedWatchlist.php index e1ba61f6..75ce7ca0 100644 --- a/includes/api/ApiFeedWatchlist.php +++ b/includes/api/ApiFeedWatchlist.php @@ -1,6 +1,6 @@ extractRequestParams(); + if( !$wgFeed ) { + $this->dieUsage( 'Syndication feeds are not available', 'feed-unavailable' ); + } + + if( !isset( $wgFeedClasses[ $params['feedformat'] ] ) ) { + $this->dieUsage( 'Invalid subscription feed type', 'feed-invalid' ); + } + // limit to the number of hours going from now back $endTime = wfTimestamp( TS_MW, time() - intval( $params['hours'] * 60 * 60 ) ); @@ -90,7 +98,7 @@ class ApiFeedWatchlist extends ApiBase { } // Check for 'allrev' parameter, and if found, show all revisions to each page on wl. - if ( !is_null( $params['allrev'] ) ) { + if ( $params['allrev'] ) { $fauxReqArr['wlallrev'] = ''; } @@ -109,10 +117,12 @@ class ApiFeedWatchlist extends ApiBase { $feedItems[] = $this->createFeedItem( $info ); } - $feedTitle = $wgSitename . ' - ' . wfMsgForContent( 'watchlist' ) . ' [' . $wgLanguageCode . ']'; + $msg = wfMsgForContent( 'watchlist' ); + + $feedTitle = $wgSitename . ' - ' . $msg . ' [' . $wgLanguageCode . ']'; $feedUrl = SpecialPage::getTitleFor( 'Watchlist' )->getFullURL(); - $feed = new $wgFeedClasses[$params['feedformat']] ( $feedTitle, htmlspecialchars( wfMsgForContent( 'watchlist' ) ), $feedUrl ); + $feed = new $wgFeedClasses[$params['feedformat']] ( $feedTitle, htmlspecialchars( $msg ), $feedUrl ); ApiFormatFeedWrapper::setResult( $this->getResult(), $feed, $feedItems ); @@ -171,7 +181,7 @@ class ApiFeedWatchlist extends ApiBase { ApiBase::PARAM_MIN => 1, ApiBase::PARAM_MAX => 72, ), - 'allrev' => null, + 'allrev' => false, 'wlowner' => array( ApiBase::PARAM_TYPE => 'user' ), @@ -189,22 +199,33 @@ class ApiFeedWatchlist extends ApiBase { 'allrev' => 'Include multiple revisions of the same page within given timeframe', 'wlowner' => "The user whose watchlist you want (must be accompanied by {$this->getModulePrefix()}token if it's not you)", 'wltoken' => 'Security token that requested user set in their preferences', - 'linktodiffs'=> 'Link to change differences instead of article pages' + 'linktodiffs' => 'Link to change differences instead of article pages' ); } public function getDescription() { - return 'This module returns a watchlist feed'; + return 'Returns a watchlist feed'; + } + + public function getPossibleErrors() { + 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' ), + ) ); } protected function getExamples() { return array( 'api.php?action=feedwatchlist', - 'api.php?action=feedwatchlist&allrev=allrev&linktodiffs=&hours=6' + 'api.php?action=feedwatchlist&allrev=&linktodiffs=&hours=6' ); } + public function getHelpUrls() { + return 'https://www.mediawiki.org/wiki/API:Watchlist_feed'; + } + public function getVersion() { - return __CLASS__ . ': $Id: ApiFeedWatchlist.php 77674 2010-12-03 19:47:22Z catrope $'; + return __CLASS__ . ': $Id: ApiFeedWatchlist.php 104449 2011-11-28 15:52:04Z reedy $'; } } -- cgit v1.2.3-54-g00ecf