r89562 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89561‎ | r89562 | r89563 >
Date:14:06, 6 June 2011
Author:reedy
Status:resolved (Comments)
Tags:
Comment:
Make ApiFeedWatchlist obey $wgFeed, and also die with an error if an invalid feed formatter is given
Modified paths:
  • /trunk/phase3/includes/api/ApiFeedWatchlist.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiFeedWatchlist.php
@@ -56,11 +56,19 @@
5757 * Wrap the result as an RSS/Atom feed.
5858 */
5959 public function execute() {
60 - global $wgFeedClasses, $wgFeedLimit, $wgSitename, $wgLanguageCode;
 60+ global $wgFeed, $wgFeedClasses, $wgFeedLimit, $wgSitename, $wgLanguageCode;
6161
6262 try {
6363 $params = $this->extractRequestParams();
6464
 65+ if( !$wgFeed ) {
 66+ $this->dieUsage( 'Syndication feeds are not available', 'feed-unavailable' );
 67+ }
 68+
 69+ if( !isset( $wgFeedClasses[ $params['feed'] ] ) ) {
 70+ $this->dieUsage( 'Invalid subscription feed type', 'feed-invalid' );
 71+ }
 72+
6573 // limit to the number of hours going from now back
6674 $endTime = wfTimestamp( TS_MW, time() - intval( $params['hours'] * 60 * 60 ) );
6775
@@ -197,6 +205,13 @@
198206 return 'Returns a watchlist feed';
199207 }
200208
 209+ public function getPossibleErrors() {
 210+ return array_merge( parent::getPossibleErrors(), array(
 211+ array( 'code' => 'feed-unavailable', 'info' => 'Syndication feeds are not available' ),
 212+ array( 'code' => 'feed-invalid', 'info' => 'Invalid subscription feed type' ),
 213+ ) );
 214+ }
 215+
201216 protected function getExamples() {
202217 return array(
203218 'api.php?action=feedwatchlist',

Follow-up revisions

RevisionCommit summaryAuthorDate
r90011Followup r89562, use 'feedformat' not 'feed'reedy21:35, 13 June 2011

Comments

#Comment by Nikerabbit (talk | contribs)   17:04, 13 June 2011

Undefined index: feed in /www/w/includes/api/ApiFeedWatchlist.php on line 68

Status & tagging log