public function execute() {
$params = $this->extractRequestParams();
- global $wgFeed, $wgFeedClasses, $wgFeedLimit, $wgSitename, $wgLanguageCode;
-
- if ( !$wgFeed ) {
+ $config = $this->getConfig();
+ if ( !$config->get( 'Feed' ) ) {
$this->dieUsage( 'Syndication feeds are not available', 'feed-unavailable' );
}
- if ( !isset( $wgFeedClasses[$params['feedformat']] ) ) {
+ $feedClasses = $config->get( 'FeedClasses' );
+ if ( !isset( $feedClasses[$params['feedformat']] ) ) {
$this->dieUsage( 'Invalid subscription feed type', 'feed-invalid' );
}
- global $wgMiserMode;
- if ( $params['showsizediff'] && $wgMiserMode ) {
+ if ( $params['showsizediff'] && $this->getConfig()->get( 'MiserMode' ) ) {
$this->dieUsage( 'Size difference is disabled in Miser Mode', 'sizediffdisabled' );
}
$msg = wfMessage( 'Contributions' )->inContentLanguage()->text();
- $feedTitle = $wgSitename . ' - ' . $msg . ' [' . $wgLanguageCode . ']';
+ $feedTitle = $config->get( 'Sitename' ) . ' - ' . $msg . ' [' . $config->get( 'LanguageCode' ) . ']';
$feedUrl = SpecialPage::getTitleFor( 'Contributions', $params['user'] )->getFullURL();
$target = $params['user'] == 'newbies'
? 'newbies'
: Title::makeTitleSafe( NS_USER, $params['user'] )->getText();
- $feed = new $wgFeedClasses[$params['feedformat']] (
+ $feed = new $feedClasses[$params['feedformat']] (
$feedTitle,
htmlspecialchars( $msg ),
$feedUrl
'showSizeDiff' => $params['showsizediff'],
) );
- if ( $pager->getLimit() > $wgFeedLimit ) {
- $pager->setLimit( $wgFeedLimit );
+ $feedLimit = $this->getConfig()->get( 'FeedLimit' );
+ if ( $pager->getLimit() > $feedLimit ) {
+ $pager->setLimit( $feedLimit );
}
$feedItems = array();
return new FeedItem(
$title->getPrefixedText(),
$this->feedItemDesc( $revision ),
- $title->getFullURL(),
+ $title->getFullURL( array( 'diff' => $revision->getId() ) ),
$date,
$this->feedItemAuthor( $revision ),
$comments
}
/**
- * @param $revision Revision
+ * @param Revision $revision
* @return string
*/
protected function feedItemAuthor( $revision ) {
}
/**
- * @param $revision Revision
+ * @param Revision $revision
* @return string
*/
protected function feedItemDesc( $revision ) {
}
public function getAllowedParams() {
- global $wgFeedClasses;
- $feedFormatNames = array_keys( $wgFeedClasses );
+ $feedFormatNames = array_keys( $this->getConfig()->get( 'FeedClasses' ) );
return array(
'feedformat' => array(
}
public function getDescription() {
- return 'Returns a user contributions 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' ),
- array( 'code' => 'sizediffdisabled', 'info' => 'Size difference is disabled in Miser Mode' ),
- ) );
+ return 'Returns a user contributions feed.';
}
public function getExamples() {