Merge "Add 'mw-anonuserlink' class for anonymous users"
[lhc/web/wiklou.git] / includes / api / ApiFeedRecentChanges.php
index f1c1bf3..a2641ee 100644 (file)
@@ -52,6 +52,12 @@ class ApiFeedRecentChanges extends ApiBase {
                        $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'
@@ -80,6 +86,10 @@ class ApiFeedRecentChanges extends ApiBase {
        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() )