Special:Random now carries over query string parameters
authorRoan Kattouw <catrope@users.mediawiki.org>
Thu, 15 Apr 2010 11:54:16 +0000 (11:54 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Thu, 15 Apr 2010 11:54:16 +0000 (11:54 +0000)
RELEASE-NOTES
includes/specials/SpecialRandompage.php

index ed91637..d75078f 100644 (file)
@@ -46,6 +46,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 22474) {{urlencode:}} now takes an optional second paramter for type of
   escaping.
 * Special:Listfiles now supports a username parameter
+* Special:Random carries over query string parameters
 
 === Bug fixes in 1.17 ===
 * (bug 17560) Half-broken deletion moved image files to deletion archive
index fd3f17f..ed6651f 100644 (file)
@@ -33,7 +33,7 @@ class RandomPage extends SpecialPage {
        }
 
        public function execute( $par ) {
-               global $wgOut, $wgContLang;
+               global $wgOut, $wgContLang, $wgRequest;
 
                if ($par) {
                        $this->setNamespace( $wgContLang->getNsIndex( $par ) );
@@ -48,7 +48,9 @@ class RandomPage extends SpecialPage {
                        return;
                }
 
-               $query = $this->isRedirect() ? 'redirect=no' : '';
+               $redirectParam = $this->isRedirect() ? array( 'redirect' => 'no' ) : array();
+               $query = array_merge( $wgRequest->getValues(), $redirectParam );
+               unset( $query['title'] );
                $wgOut->redirect( $title->getFullUrl( $query ) );
        }