Merge "Make RandomInCat work for cats starting with namespace"
[lhc/web/wiklou.git] / includes / specials / SpecialRandomInCategory.php
index 368c467..6478452 100644 (file)
@@ -76,6 +76,11 @@ class SpecialRandomInCategory extends SpecialPage {
                        $cat = Title::newFromText( $categoryStr, NS_CATEGORY );
                }
 
+               if ( $cat && $cat->getNamespace() !== NS_CATEGORY ) {
+                       // Someone searching for something like "Wikipedia:Foo"
+                       $cat = Title::makeTitleSafe( NS_CATEGORY, $categoryStr );
+               }
+
                if ( $cat ) {
                        $this->setCategory( $cat );
                }