From cc7a0a8d9e5eceb6d990dcadbfe7dca0f2991e96 Mon Sep 17 00:00:00 2001 From: Daniel Cannon Date: Fri, 22 Jun 2007 06:23:02 +0000 Subject: [PATCH] Special:Randompage with no parameters now selects a random page from any namespace in $wgContentNamespaces, rather than just from NS_MAIN. --- RELEASE-NOTES | 2 ++ includes/SpecialRandompage.php | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 64b3724ba0..6dd48abfa6 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -99,6 +99,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN policies. This can be done only by users with the 'editrobots' permission * Use $wgJobClasses to determine the correct Job to instantiate for a particular queued task; allows extensions to introduce custom jobs +* Special:Randompage with no parameters now selects a random page from any + namespace in $wgContentNamespaces, rather than just from NS_MAIN. == Bugfixes since 1.10 == diff --git a/includes/SpecialRandompage.php b/includes/SpecialRandompage.php index e6c4abe829..de6450b886 100644 --- a/includes/SpecialRandompage.php +++ b/includes/SpecialRandompage.php @@ -16,7 +16,17 @@ function wfSpecialRandompage( $par = null ) { global $wgOut, $wgContLang; $rnd = new RandomPage(); - $rnd->setNamespace( $wgContLang->getNsIndex( $par ) ); + + if ( $par == null ) { + // Select a random content namespace to use. + global $wgContentNamespaces; + $n = array_rand( $wgContentNamespaces ); + $rnd->setNamespace( $wgContentNamespaces[$n] ); + } + else { + $rnd->setNamespace( $wgContLang->getNsIndex( $par ) ); + } + $rnd->setRedirect( false ); $title = $rnd->getRandomTitle(); -- 2.20.1