* (bug 5757) Fix premature cutoff in LanguageConverter with extra end markers
* (bug 5516) Show appropriate "return to" link on blocked page
* (bug 5377) Do not auto-login when creating an account as another user
+* (bug 5284) Special redirect pages should remember parameters
== Compatibility ==
return isset( $redirects[$name] ) ? $redirects[$name] : null;
}
+ /**
+ * Return part of the request string for a special redirect page
+ * This allows passing, e.g. action=history to Special:Mypage, etc.
+ *
+ * @param $name Name of the redirect page
+ * @return string
+ */
+ function getRedirectParams( $name ) {
+ global $wgRequest;
+
+ $args = array();
+ switch( $name ) {
+ case 'Mypage':
+ case 'Mytalk':
+ case 'Randompage':
+ $args = array( 'action' );
+ }
+
+ $params = array();
+ foreach( $args as $arg ) {
+ if( $val = $wgRequest->getVal( $arg, false ) )
+ $params[] = $arg . '=' . $val;
+ }
+
+ return count( $params ) ? implode( '&', $params ) : false;
+ }
+
/**
* Return categorised listable special pages
* Returns a 2d array where the first index is the restriction name
} else {
$redir = SpecialPage::getRedirect( $name );
if ( isset( $redir ) ) {
- if ( isset( $par ) )
- $wgOut->redirect( $redir->getFullURL() . '/' . $par );
- else
- $wgOut->redirect( $redir->getFullURL() );
+ $params = SpecialPage::getRedirectParams( $name );
+ if( $params ) {
+ $url = $redir->getFullUrl( $params );
+ } elseif( $par ) {
+ $url = $redir->getFullUrl() . '/' . $par;
+ } else {
+ $url = $redir->getFullUrl();
+ }
+ $wgOut->redirect( $url );
$retVal = $redir;
} else {
$wgOut->setArticleRelated( false );