From 589b2af808aa4c44d193a1eb6e82f57bc70e20ed Mon Sep 17 00:00:00 2001 From: Reedy Date: Tue, 10 Sep 2013 21:10:48 +0100 Subject: [PATCH] Improved search backend fallback in Special:Search Use the srbackend parameter if it's valid. If it's not, use $wgSearchType if it's not null. Finally, fall back to the search type of the database. Bug: 53982 Change-Id: I3605cb4add270543aa20afb037401b2dfbe462f0 --- includes/search/SearchEngine.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/includes/search/SearchEngine.php b/includes/search/SearchEngine.php index b691c7545e..e5925fa344 100644 --- a/includes/search/SearchEngine.php +++ b/includes/search/SearchEngine.php @@ -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; -- 2.20.1