From cc38d6d321374849590434d4a648ef0ef9fdf01a Mon Sep 17 00:00:00 2001 From: Magnus Manske Date: Thu, 4 May 2006 09:41:33 +0000 Subject: [PATCH] Fixed namespace handling (will now accept English namespace names in addition to localized ones) --- includes/SpecialRandompage.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/includes/SpecialRandompage.php b/includes/SpecialRandompage.php index cf6ecc03b7..9d38abcb39 100644 --- a/includes/SpecialRandompage.php +++ b/includes/SpecialRandompage.php @@ -11,14 +11,12 @@ * used as e.g. Special:Randompage/Category */ function wfSpecialRandompage( $par = NS_MAIN ) { - global $wgOut, $wgExtraRandompageSQL, $wgContLang; + global $wgOut, $wgExtraRandompageSQL, $wgContLang, $wgLang; $fname = 'wfSpecialRandompage'; - # Determine the namespace to get a random page from. - $namespace = $wgContLang->getNsIndex($par); - if ($namespace === false || $namespace < NS_MAIN) { - $namespace = NS_MAIN; - } + # Determine namespace + $t = Title::newFromText ( $par . ":Dummy" ) ; + $namespace = $t->getNamespace () ; # NOTE! We use a literal constant in the SQL instead of the RAND() # function because RAND() will return a different value for every row -- 2.20.1