From: Brian Wolff Date: Fri, 20 Jun 2014 14:38:22 +0000 (-0300) Subject: Allow specifying a random page only in main namespace X-Git-Tag: 1.31.0-rc.0~14776 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=77cfbb888ecdd84809dcebbc02acc3fa44264495;p=lhc%2Fweb%2Fwiklou.git Allow specifying a random page only in main namespace Make Special:Random/ get you a page in NS_MAIN. Previously it got a page in the content namespaces. Special:Random (no /) still returns pages from all content namespaces. This also affects Special:RandomRootPage from the RandomRootPage extension. Bug: 46420 Change-Id: I9ce66b534b86eaa09236dd56dab7ac18d1ef37ec --- diff --git a/includes/specials/SpecialRandompage.php b/includes/specials/SpecialRandompage.php index 24b363def5..6d8f59b571 100644 --- a/includes/specials/SpecialRandompage.php +++ b/includes/specials/SpecialRandompage.php @@ -56,7 +56,9 @@ class RandomPage extends SpecialPage { public function execute( $par ) { global $wgContLang; - if ( $par ) { + if ( is_string( $par ) ) { + // Testing for stringiness since we want to catch + // the empty string to mean main namespace only. $this->setNamespace( $wgContLang->getNsIndex( $par ) ); }