From: Niklas Laxström Date: Tue, 20 Dec 2011 11:17:36 +0000 (+0000) Subject: Fix for bug 33270: default to 'default' search profile X-Git-Tag: 1.31.0-rc.0~25873 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmes_infos.php?a=commitdiff_plain;h=91a03b9b584055b7760c29595d0cb443ba9a875d;p=lhc%2Fweb%2Fwiklou.git Fix for bug 33270: default to 'default' search profile Had this fixed in one of my wikies but not committed --- diff --git a/includes/specials/SpecialSearch.php b/includes/specials/SpecialSearch.php index c2fac94b17..f884401b14 100644 --- a/includes/specials/SpecialSearch.php +++ b/includes/specials/SpecialSearch.php @@ -117,15 +117,19 @@ class SpecialSearch extends SpecialPage { $user = $this->getUser(); # Extract manually requested namespaces $nslist = $this->powerSearch( $request ); - $this->profile = $profile = $request->getVal( 'profile', null ); + $profile = null; + if ( !count( $nslist ) ) { + $profile = 'default'; + } + $profile = $request->getVal( 'profile', $profile ); $profiles = $this->getSearchProfiles(); - if ( $profile === null) { + if ( $profile === null ) { // BC with old request format - $this->profile = 'advanced'; + $profile = 'advanced'; if ( count( $nslist ) ) { foreach( $profiles as $key => $data ) { if ( $nslist === $data['namespaces'] && $key !== 'advanced') { - $this->profile = $key; + $profile = $key; } } $this->namespaces = $nslist; @@ -139,7 +143,7 @@ class SpecialSearch extends SpecialPage { $this->namespaces = $profiles[$profile]['namespaces']; } else { // Unknown profile requested - $this->profile = 'default'; + $profile = 'default'; $this->namespaces = $profiles['default']['namespaces']; } } @@ -149,6 +153,7 @@ class SpecialSearch extends SpecialPage { $this->searchRedirects = $request->getBool( 'redirs', $default ) ? 1 : 0; $this->didYouMeanHtml = ''; # html of did you mean... link $this->fulltext = $request->getVal('fulltext'); + $this->profile = $profile; } /**