http://www.mediawiki.org/wiki/Special:Code/MediaWiki/70627

Revision: 70627
Author:   siebrand
Date:     2010-08-07 12:45:10 +0000 (Sat, 07 Aug 2010)

Log Message:
-----------
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: trunk/phase3/includes/specials/SpecialSearch.php
===================================================================
--- trunk/phase3/includes/specials/SpecialSearch.php    2010-08-07 12:43:53 UTC 
(rev 70626)
+++ trunk/phase3/includes/specials/SpecialSearch.php    2010-08-07 12:45:10 UTC 
(rev 70627)
@@ -119,41 +119,7 @@
                wfProfileIn( __METHOD__ );
 
                $sk = $wgUser->getSkin();
-               
-               $beginSearchForm = Xml::openElement(
-                       'form',
-                       array(
-                               'id' => ( $this->searchAdvanced ? 'powersearch' 
: 'search' ),
-                               'method' => 'get',
-                               'action' => $wgScript
-                       )
-               );
-               $mwSearchTopTable =
-                       Xml::openElement( 'table', array( 'id' => 
'mw-search-top-table', 'border' => 0, 'cellpadding' => 0, 'cellspacing' => 0 ) 
) .
-                       Xml::openElement( 'tr' ) .
-                       Xml::openElement( 'td' ) . "\n" .
-                       $this->shortDialog( $term ) .
-                       Xml::closeElement( 'td' ) .
-                       Xml::closeElement( 'tr' ) .
-                       Xml::closeElement( 'table' );
-               
-               // moved to check for empty or null search string before 
running query
-               // to prevent NULL fulltext search error in SQL Server
-               $filePrefix = $wgContLang->getFormattedNsText( NS_FILE ) . ':';
-               if ( trim( $term ) === '' || $filePrefix === trim( $term ) ) {
-                       $wgOut->addHTML( $beginSearchForm );
-                       $wgOut->addHTML( $mwSearchTopTable );
-                       $wgOut->addHTML( $this->searchFocus() );
-                       $wgOut->addHTML( $this->formHeader( $term, 0, 0 ) );
-                       if ( $this->searchAdvanced ) {
-                               $wgOut->addHTML( $this->powerSearchBox( $term ) 
);
-                       }
-                       $wgOut->addHTML( Xml::closeElement( 'form' ) );
-                       // Empty query -- straight view of search form
-                       wfProfileOut( __METHOD__ );
-                       return;
-               }
-               
+
                $this->searchEngine = SearchEngine::create();
                $search =& $this->searchEngine;
                $search->setLimitOffset( $this->limit, $this->offset );
@@ -228,10 +194,23 @@
                }
                // start rendering the page
                $wgOut->addHtml(
-                       $beginSearchForm
+                       Xml::openElement(
+                               'form',
+                               array(
+                                       'id' => ( $this->searchAdvanced ? 
'powersearch' : 'search' ),
+                                       'method' => 'get',
+                                       'action' => $wgScript
+                               )
+                       )
                );
                $wgOut->addHtml(
-                       $mwSearchTopTable
+                       Xml::openElement( 'table', array( 
'id'=>'mw-search-top-table', 'border'=>0, 'cellpadding'=>0, 'cellspacing'=>0 ) 
) .
+                       Xml::openElement( 'tr' ) .
+                       Xml::openElement( 'td' ) . "\n" .
+                       $this->shortDialog( $term ) .
+                       Xml::closeElement('td') .
+                       Xml::closeElement('tr') .
+                       Xml::closeElement('table')
                );
 
                // Sometimes the search engine knows there are too many hits
@@ -241,6 +220,19 @@
                        return;
                }
 
+               $filePrefix = $wgContLang->getFormattedNsText(NS_FILE).':';
+               if( trim( $term ) === '' || $filePrefix === trim( $term ) ) {
+                       $wgOut->addHTML( $this->searchFocus() );
+                       $wgOut->addHTML( $this->formHeader($term, 0, 0));
+                       if( $this->searchAdvanced ) {
+                               $wgOut->addHTML( $this->powerSearchBox( $term ) 
);
+                       } 
+                       $wgOut->addHTML( '</form>' );
+                       // Empty query -- straight view of search form
+                       wfProfileOut( __METHOD__ );
+                       return;
+               }
+
                // Get number of results
                $titleMatchesNum = $titleMatches ? $titleMatches->numRows() : 0;
                $textMatchesNum = $textMatches ? $textMatches->numRows() : 0;



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to