Followup r89566
authorSam Reed <reedy@users.mediawiki.org>
Sat, 25 Jun 2011 16:41:29 +0000 (16:41 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Sat, 25 Jun 2011 16:41:29 +0000 (16:41 +0000)
Per CR, add HTTP redirect from old feed listing on Special:Contributions to using the api module output

includes/specials/SpecialContributions.php

index 0497f8f..0c6560d 100644 (file)
@@ -115,6 +115,41 @@ class SpecialContributions extends SpecialPage {
                        $this->opts['month'] = $wgRequest->getIntOrNull( 'month' );
                }
 
+               $feedType = $wgRequest->getVal( 'feed' );
+               if( $feedType ) {
+                       $apiParams = array(
+                               'action' => 'feedcontributions',
+                               'feedformat' => $feedType,
+                               'user' => $target,
+                       );
+                       if ( $this->opts['topOnly'] ) {
+                               $apiParams['toponly'] = true;
+                       }
+                       if ( $this->opts['showSizeDiff'] ) {
+                               $apiParams['showsizediff'] = true;
+                       }
+                       if ( $this->opts['deletedonly'] ) {
+                               $apiParams['deletedonly'] = true;
+                       }
+                       if ( $this->opts['tagFilter'] !== '' ) {
+                               $apiParams['tagfilter'] = $this->opts['tagFilter'];
+                       }
+                       if ( $this->opts['namespace'] !== '' ) {
+                               $apiParams['namespace'] = $this->opts['namespace'];
+                       }
+                       if ( $this->opts['year'] !== null ) {
+                               $apiParams['year'] = $this->opts['year'];
+                       }
+                       if ( $this->opts['month'] !== null ) {
+                               $apiParams['month'] = $this->opts['month'];
+                       }
+
+                       $url = wfScript( 'api' ) . '?' . wfArrayToCGI( $apiParams );
+
+                       $wgOut->redirect( $url, '301' );
+                       return;
+               }
+
                // Add RSS/atom links
                $this->addFeedLinks( array( 'action' => 'feedcontributions', 'user' => $wgUser->getName() ) );