From: Robert Leverington Date: Tue, 21 Jul 2009 20:18:56 +0000 (+0000) Subject: * Replace $wgSecondaryGoNamespace with $wgSecondaryGoNamespaces (taking an array... X-Git-Tag: 1.31.0-rc.0~40781 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=26a1064ad2cbeb4a881176a8df5ef223a6b4909b;p=lhc%2Fweb%2Fwiklou.git * Replace $wgSecondaryGoNamespace with $wgSecondaryGoNamespaces (taking an array of integers instead of just an integer), per code review of r53600. --- diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 740bf2e08a..af406d9a6d 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -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; diff --git a/includes/SearchEngine.php b/includes/SearchEngine.php index 533f52689e..aab14cbba1 100644 --- a/includes/SearchEngine.php +++ b/includes/SearchEngine.php @@ -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)