r106780 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106779‎ | r106780 | r106781 >
Date:11:17, 20 December 2011
Author:nikerabbit
Status:resolved (Comments)
Tags:
Comment:
Fix for bug 33270: default to 'default' search profile
Had this fixed in one of my wikies but not committed
Modified paths:
  • /trunk/phase3/includes/specials/SpecialSearch.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialSearch.php
@@ -117,15 +117,19 @@
118118 $user = $this->getUser();
119119 # Extract manually requested namespaces
120120 $nslist = $this->powerSearch( $request );
121 - $this->profile = $profile = $request->getVal( 'profile', null );
 121+ $profile = null;
 122+ if ( !count( $nslist ) ) {
 123+ $profile = 'default';
 124+ }
 125+ $profile = $request->getVal( 'profile', $profile );
122126 $profiles = $this->getSearchProfiles();
123 - if ( $profile === null) {
 127+ if ( $profile === null ) {
124128 // BC with old request format
125 - $this->profile = 'advanced';
 129+ $profile = 'advanced';
126130 if ( count( $nslist ) ) {
127131 foreach( $profiles as $key => $data ) {
128132 if ( $nslist === $data['namespaces'] && $key !== 'advanced') {
129 - $this->profile = $key;
 133+ $profile = $key;
130134 }
131135 }
132136 $this->namespaces = $nslist;
@@ -139,7 +143,7 @@
140144 $this->namespaces = $profiles[$profile]['namespaces'];
141145 } else {
142146 // Unknown profile requested
143 - $this->profile = 'default';
 147+ $profile = 'default';
144148 $this->namespaces = $profiles['default']['namespaces'];
145149 }
146150 }
@@ -149,6 +153,7 @@
150154 $this->searchRedirects = $request->getBool( 'redirs', $default ) ? 1 : 0;
151155 $this->didYouMeanHtml = ''; # html of did you mean... link
152156 $this->fulltext = $request->getVal('fulltext');
 157+ $this->profile = $profile;
153158 }
154159
155160 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r107975MFT r105341, t105853, r106780reedy00:40, 4 January 2012
r108400test skeleton for Special:Search...hashar11:41, 9 January 2012
r108712bug 33583 search ns user pref ignored!...hashar09:03, 12 January 2012

Comments

#Comment by Umherirrender (talk | contribs)   21:43, 6 January 2012

This makes the preferences for the search options "Otherwise search in these namespaces" useless, because Special:Search is not loaded with that namespaces anymore, the old "advanced" profile respect that setting and prefilled the checkboxes on the first visit.

When now clicking "advanced" no checkbox is prefilled.

#Comment by Bawolff (talk | contribs)   17:23, 7 January 2012

Someone filed that as bug 33583

#Comment by Hashar (talk | contribs)   11:42, 9 January 2012

I have added a test case with r108400 albeit commented out.

#Comment by Hashar (talk | contribs)   09:05, 12 January 2012

uncommented with r108712

#Comment by Hashar (talk | contribs)   09:04, 12 January 2012

Resolved by r108712

Status & tagging log