Merge "Make Special:MediaStatistics show a total count of file sizes"
[lhc/web/wiklou.git] / includes / specials / SpecialSearch.php
index d6ce6a4..8809900 100644 (file)
@@ -99,6 +99,7 @@ class SpecialSearch extends SpecialPage {
                        'mediawiki.special', 'mediawiki.special.search', 'mediawiki.ui', 'mediawiki.ui.button',
                        'mediawiki.ui.input',
                ) );
+               $this->addHelpLink( 'Help:Searching' );
 
                // Strip underscores from title parameter; most of the time we'll want
                // text form here. But don't strip underscores from actual text params!
@@ -383,11 +384,10 @@ class SpecialSearch extends SpecialPage {
                                $out->addHTML( $this->showInterwiki( $textMatches->getInterwikiResults(
                                                SearchResultSet::SECONDARY_RESULTS ), $term ) );
                        }
-
-                       $textMatches->free();
                }
 
-               $hasOtherResults = $textMatches->hasInterwikiResults( SearchResultSet::INLINE_RESULTS );
+               $hasOtherResults = $textMatches &&
+                       $textMatches->hasInterwikiResults( SearchResultSet::INLINE_RESULTS );
 
                if ( $num === 0 ) {
                        if ( $textStatus ) {
@@ -414,6 +414,10 @@ class SpecialSearch extends SpecialPage {
                        }
                }
 
+               if ( $textMatches ) {
+                       $textMatches->free();
+               }
+
                $out->addHTML( '<div class="visualClear"></div>' );
 
                if ( $prevnext ) {
@@ -430,6 +434,7 @@ class SpecialSearch extends SpecialPage {
         * Produce wiki header for interwiki results
         * @param string $interwiki Interwiki name
         * @param SearchResultSet $interwikiResult The result set
+        * @return string
         */
        protected function interwikiHeader( $interwiki, $interwikiResult ) {
                // TODO: we need to figure out how to name wikis correctly
@@ -848,6 +853,7 @@ class SpecialSearch extends SpecialPage {
                $html = null;
 
                $score = '';
+               $related = '';
                if ( Hooks::run( 'ShowSearchHit', array(
                        $this, $result, $terms,
                        &$link, &$redirect, &$section, &$extract,