Merge "mediawiki.user: Return a promise from getRights/getGroups"
[lhc/web/wiklou.git] / includes / search / SearchEngine.php
index b691c75..71c05d8 100644 (file)
@@ -462,13 +462,16 @@ class SearchEngine {
                $dbr = null;
 
                $alternatives = self::getSearchTypes();
-               $type = $type !== null ? $type : $wgSearchType;
+
                if ( $type && in_array( $type, $alternatives ) ) {
                        $class = $type;
+               } elseif ( $wgSearchType !== null ) {
+                       $class = $wgSearchType;
                } else {
                        $dbr = wfGetDB( DB_SLAVE );
                        $class = $dbr->getSearchEngine();
                }
+
                $search = new $class( $dbr );
                $search->setLimitOffset( 0, 0 );
                return $search;
@@ -874,11 +877,11 @@ class SearchResult {
         * @return String: highlighted text snippet, null (and not '') if not supported
         */
        function getTextSnippet( $terms ) {
-               global $wgUser, $wgAdvancedSearchHighlighting;
+               global $wgAdvancedSearchHighlighting;
                $this->initText();
 
                // TODO: make highliter take a content object. Make ContentHandler a factory for SearchHighliter.
-               list( $contextlines, $contextchars ) = SearchEngine::userHighlightPrefs( $wgUser );
+               list( $contextlines, $contextchars ) = SearchEngine::userHighlightPrefs();
                $h = new SearchHighlighter();
                if ( $wgAdvancedSearchHighlighting ) {
                        return $h->highlightText( $this->mText, $terms, $contextlines, $contextchars );