* Replace $wgSecondaryGoNamespace with $wgSecondaryGoNamespaces (taking an array...
authorRobert Leverington <roberthl@users.mediawiki.org>
Tue, 21 Jul 2009 20:18:56 +0000 (20:18 +0000)
committerRobert Leverington <roberthl@users.mediawiki.org>
Tue, 21 Jul 2009 20:18:56 +0000 (20:18 +0000)
includes/DefaultSettings.php
includes/SearchEngine.php

index 740bf2e..af406d9 100644 (file)
@@ -4087,9 +4087,9 @@ $wgAutocreatePolicy = 'login';
 $wgAllowPrefChange = array();
 
 /**
- * If an exact match is not found, try to find a match in a different namespace
+ * If an exact match is not found, try to find a match in different namespaces
  * before performing a search.
  *
- * Integer: Id of namespace to attempt match in.
+ * Array: Ids of namespaces to attempt match in, in desired order.
  */
-$wgSecondaryGoNamespace = null;
+$wgSecondaryGoNamespaces = null;
index 533f526..aab14cb 100644 (file)
@@ -63,7 +63,7 @@ class SearchEngine {
         * @return Title
         */
        public static function getNearMatch( $searchterm ) {
-               global $wgContLang, $wgSecondaryGoNamespace;
+               global $wgContLang, $wgSecondaryGoNamespaces;
 
                $allSearchTerms = array($searchterm);
 
@@ -88,10 +88,12 @@ class SearchEngine {
                                return $title;
                        }
 
-                       # If a match is not found in the main namespace look in secondary go namespace.
-                       if( $wgSecondaryGoNamespace && $title->getNamespace() == NS_MAIN ) {
-                               $title = Title::newFromText( $term, $wgSecondaryGoNamespace );
-                               if( $title && $title->exists() ) return $title;
+                       # If a match is not found in the main namespace look in secondary go namespaces.
+                       if( $wgSecondaryGoNamespaces && $title->getNamespace() == NS_MAIN ) {
+                               foreach( $wgSecondaryGoNamespaces as $ns ) {
+                                       $title = Title::newFromText( $term, $ns );
+                                       if( $title && $title->exists() ) return $title;
+                               }
                        }
 
                        # Now try all lower case (i.e. first letter capitalized)