From 91a03b9b584055b7760c29595d0cb443ba9a875d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Niklas=20Laxstr=C3=B6m?= Date: Tue, 20 Dec 2011 11:17:36 +0000 Subject: [PATCH] Fix for bug 33270: default to 'default' search profile Had this fixed in one of my wikies but not committed --- includes/specials/SpecialSearch.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) 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; } /** -- 2.20.1