r70627 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70626‎ | r70627 | r70628 >
Date:12:45, 7 August 2010
Author:siebrand
Status:ok
Tags:
Comment:
Revert changes to SpecialSearch.php in r70608 because Special:Search didn't load anymore.

PHP Notice: Undefined property: SpecialSearch::$searchEngine in /www/w/includes/specials/SpecialSearch.php on line 796

catrope on IRC:
It asks the backend ($this->searchEngine) if it supports redirects but $this->searchEngine is only set in the code that generates results
So viewing Special:Search with no results listing has that var unset
Modified paths:
  • /trunk/phase3/includes/specials/SpecialSearch.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialSearch.php
@@ -119,41 +119,7 @@
120120 wfProfileIn( __METHOD__ );
121121
122122 $sk = $wgUser->getSkin();
123 -
124 - $beginSearchForm = Xml::openElement(
125 - 'form',
126 - array(
127 - 'id' => ( $this->searchAdvanced ? 'powersearch' : 'search' ),
128 - 'method' => 'get',
129 - 'action' => $wgScript
130 - )
131 - );
132 - $mwSearchTopTable =
133 - Xml::openElement( 'table', array( 'id' => 'mw-search-top-table', 'border' => 0, 'cellpadding' => 0, 'cellspacing' => 0 ) ) .
134 - Xml::openElement( 'tr' ) .
135 - Xml::openElement( 'td' ) . "\n" .
136 - $this->shortDialog( $term ) .
137 - Xml::closeElement( 'td' ) .
138 - Xml::closeElement( 'tr' ) .
139 - Xml::closeElement( 'table' );
140 -
141 - // moved to check for empty or null search string before running query
142 - // to prevent NULL fulltext search error in SQL Server
143 - $filePrefix = $wgContLang->getFormattedNsText( NS_FILE ) . ':';
144 - if ( trim( $term ) === '' || $filePrefix === trim( $term ) ) {
145 - $wgOut->addHTML( $beginSearchForm );
146 - $wgOut->addHTML( $mwSearchTopTable );
147 - $wgOut->addHTML( $this->searchFocus() );
148 - $wgOut->addHTML( $this->formHeader( $term, 0, 0 ) );
149 - if ( $this->searchAdvanced ) {
150 - $wgOut->addHTML( $this->powerSearchBox( $term ) );
151 - }
152 - $wgOut->addHTML( Xml::closeElement( 'form' ) );
153 - // Empty query -- straight view of search form
154 - wfProfileOut( __METHOD__ );
155 - return;
156 - }
157 -
 123+
158124 $this->searchEngine = SearchEngine::create();
159125 $search =& $this->searchEngine;
160126 $search->setLimitOffset( $this->limit, $this->offset );
@@ -228,10 +194,23 @@
229195 }
230196 // start rendering the page
231197 $wgOut->addHtml(
232 - $beginSearchForm
 198+ Xml::openElement(
 199+ 'form',
 200+ array(
 201+ 'id' => ( $this->searchAdvanced ? 'powersearch' : 'search' ),
 202+ 'method' => 'get',
 203+ 'action' => $wgScript
 204+ )
 205+ )
233206 );
234207 $wgOut->addHtml(
235 - $mwSearchTopTable
 208+ Xml::openElement( 'table', array( 'id'=>'mw-search-top-table', 'border'=>0, 'cellpadding'=>0, 'cellspacing'=>0 ) ) .
 209+ Xml::openElement( 'tr' ) .
 210+ Xml::openElement( 'td' ) . "\n" .
 211+ $this->shortDialog( $term ) .
 212+ Xml::closeElement('td') .
 213+ Xml::closeElement('tr') .
 214+ Xml::closeElement('table')
236215 );
237216
238217 // Sometimes the search engine knows there are too many hits
@@ -241,6 +220,19 @@
242221 return;
243222 }
244223
 224+ $filePrefix = $wgContLang->getFormattedNsText(NS_FILE).':';
 225+ if( trim( $term ) === '' || $filePrefix === trim( $term ) ) {
 226+ $wgOut->addHTML( $this->searchFocus() );
 227+ $wgOut->addHTML( $this->formHeader($term, 0, 0));
 228+ if( $this->searchAdvanced ) {
 229+ $wgOut->addHTML( $this->powerSearchBox( $term ) );
 230+ }
 231+ $wgOut->addHTML( '</form>' );
 232+ // Empty query -- straight view of search form
 233+ wfProfileOut( __METHOD__ );
 234+ return;
 235+ }
 236+
245237 // Get number of results
246238 $titleMatchesNum = $titleMatches ? $titleMatches->numRows() : 0;
247239 $textMatchesNum = $textMatches ? $textMatches->numRows() : 0;

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r70608DatabaseMssql class and related changesyaauie23:44, 6 August 2010

Status & tagging log