Index: branches/wmf/1.18wmf1/includes/specials/SpecialSearch.php |
— | — | @@ -87,6 +87,9 @@ |
88 | 88 | |
89 | 89 | /** |
90 | 90 | * Set up basic search parameters from the request and user settings. |
| 91 | + * |
| 92 | + * @see tests/phpunit/includes/specials/SpecialSearchTest.php |
| 93 | + * |
91 | 94 | * Typically you'll pass $wgRequest and $wgUser. |
92 | 95 | * |
93 | 96 | * @param $request WebRequest |
— | — | @@ -97,27 +100,30 @@ |
98 | 101 | $this->mPrefix = $request->getVal( 'prefix', '' ); |
99 | 102 | |
100 | 103 | |
| 104 | + |
101 | 105 | # Extract manually requested namespaces |
102 | 106 | $nslist = $this->powerSearch( $request ); |
| 107 | + if ( !count( $nslist ) ) { |
| 108 | + # Fallback to user preference |
| 109 | + $nslist = SearchEngine::userNamespaces( $user ); |
| 110 | + } |
| 111 | + |
103 | 112 | $profile = null; |
104 | 113 | if ( !count( $nslist ) ) { |
105 | 114 | $profile = 'default'; |
106 | 115 | } |
| 116 | + |
107 | 117 | $profile = $request->getVal( 'profile', $profile ); |
108 | 118 | $profiles = $this->getSearchProfiles(); |
109 | 119 | if ( $profile === null ) { |
110 | 120 | // BC with old request format |
111 | 121 | $profile = 'advanced'; |
112 | | - if ( count( $nslist ) ) { |
113 | | - foreach( $profiles as $key => $data ) { |
114 | | - if ( $nslist === $data['namespaces'] && $key !== 'advanced') { |
115 | | - $profile = $key; |
116 | | - } |
| 122 | + foreach( $profiles as $key => $data ) { |
| 123 | + if ( $nslist === $data['namespaces'] && $key !== 'advanced') { |
| 124 | + $profile = $key; |
117 | 125 | } |
118 | | - $this->namespaces = $nslist; |
119 | | - } else { |
120 | | - $this->namespaces = SearchEngine::userNamespaces( $user ); |
121 | 126 | } |
| 127 | + $this->namespaces = $nslist; |
122 | 128 | } elseif ( $profile === 'advanced' ) { |
123 | 129 | $this->namespaces = $nslist; |
124 | 130 | } else { |
Property changes on: branches/wmf/1.18wmf1 |
___________________________________________________________________ |
Modified: svn:mergeinfo |
125 | 131 | Merged /trunk/phase3:r108712 |