* as an RSS/Atom feed.
*/
public function execute() {
- global $wgFeed, $wgFeedClasses;
+ $config = $this->getConfig();
$this->params = $this->extractRequestParams();
- if ( !$wgFeed ) {
+ if ( !$config->get( 'Feed' ) ) {
$this->dieUsage( 'Syndication feeds are not available', 'feed-unavailable' );
}
- if ( !isset( $wgFeedClasses[$this->params['feedformat']] ) ) {
+ $feedClasses = $config->get( 'FeedClasses' );
+ if ( !isset( $feedClasses[$this->params['feedformat']] ) ) {
$this->dieUsage( 'Invalid subscription feed type', 'feed-invalid' );
}
+ $this->getMain()->setCacheMode( 'public' );
+ if ( !$this->getMain()->getParameter( 'smaxage' ) ) {
+ // bug 63249: This page gets hit a lot, cache at least 15 seconds.
+ $this->getMain()->setCacheMaxAge( 15 );
+ }
+
$feedFormat = $this->params['feedformat'];
$specialClass = $this->params['target'] !== null
? 'SpecialRecentchangeslinked'
public function getFeedObject( $feedFormat, $specialClass ) {
if ( $specialClass === 'SpecialRecentchangeslinked' ) {
$title = Title::newFromText( $this->params['target'] );
+ if ( !$title ) {
+ $this->dieUsageMsg( array( 'invalidtitle', $this->params['target'] ) );
+ }
+
$feed = new ChangesFeed( $feedFormat, false );
$feedObj = $feed->getFeedObject(
$this->msg( 'recentchangeslinked-title', $title->getPrefixedText() )
}
public function getAllowedParams() {
- global $wgFeedClasses, $wgAllowCategorizedRecentChanges, $wgFeedLimit;
- $feedFormatNames = array_keys( $wgFeedClasses );
+ $config = $this->getConfig();
+ $feedFormatNames = array_keys( $config->get( 'FeedClasses' ) );
$ret = array(
'feedformat' => array(
'limit' => array(
ApiBase::PARAM_DFLT => 50,
ApiBase::PARAM_MIN => 1,
- ApiBase::PARAM_MAX => $wgFeedLimit,
+ ApiBase::PARAM_MAX => $config->get( 'FeedLimit' ),
ApiBase::PARAM_TYPE => 'integer',
),
'from' => array(
'showlinkedto' => false,
);
- if ( $wgAllowCategorizedRecentChanges ) {
+ if ( $config->get( 'AllowCategorizedRecentChanges' ) ) {
$ret += array(
'categories' => array(
ApiBase::PARAM_TYPE => 'string',