X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fsearch%2FSearchOracle.php;h=0cbb41c4711b17e4f6d05506b0239312f3ff170d;hb=70d9fbb0bfacaf837b7e8efb3770245d646ab522;hp=7fe5b53ca6aac508f6598d5d3537345c8028e332;hpb=8c96aec32cffaab96b2bd9dca206a99a13640545;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/search/SearchOracle.php b/includes/search/SearchOracle.php index 7fe5b53ca6..0cbb41c471 100644 --- a/includes/search/SearchOracle.php +++ b/includes/search/SearchOracle.php @@ -24,6 +24,8 @@ * @ingroup Search */ +use MediaWiki\MediaWikiServices; + /** * Search engine hook base class for Oracle (ConText). * @ingroup Search @@ -64,7 +66,7 @@ class SearchOracle extends SearchDatabase { * @param string $term Raw search term * @return SqlSearchResultSet */ - protected function doSearchText( $term ) { + protected function doSearchTextInDB( $term ) { if ( $term == '' ) { return new SqlSearchResultSet( false, '' ); } @@ -79,7 +81,7 @@ class SearchOracle extends SearchDatabase { * @param string $term Raw search term * @return SqlSearchResultSet */ - protected function doSearchTitle( $term ) { + protected function doSearchTitleInDB( $term ) { if ( $term == '' ) { return new SqlSearchResultSet( false, '' ); } @@ -96,7 +98,7 @@ class SearchOracle extends SearchDatabase { if ( is_null( $this->namespaces ) ) { return ''; } - if ( !count( $this->namespaces ) ) { + if ( $this->namespaces === [] ) { $namespaces = '0'; } else { $namespaces = $this->db->makeList( $this->namespaces ); @@ -173,7 +175,6 @@ class SearchOracle extends SearchDatabase { * @return string */ private function parseQuery( $filteredText, $fulltext ) { - global $wgContLang; $lc = $this->legalSearchChars( self::CHARS_NO_SYNTAX ); $this->searchTerms = []; @@ -185,7 +186,8 @@ class SearchOracle extends SearchDatabase { foreach ( $m as $terms ) { // Search terms in all variant forms, only // apply on wiki with LanguageConverter - $temp_terms = $wgContLang->autoConvertToAllVariants( $terms[2] ); + $temp_terms = MediaWikiServices::getInstance()->getContentLanguage()-> + autoConvertToAllVariants( $terms[2] ); if ( is_array( $temp_terms ) ) { $temp_terms = array_unique( array_values( $temp_terms ) ); foreach ( $temp_terms as $t ) { @@ -212,8 +214,7 @@ class SearchOracle extends SearchDatabase { } private function escapeTerm( $t ) { - global $wgContLang; - $t = $wgContLang->normalizeForSearch( $t ); + $t = MediaWikiServices::getInstance()->getContentLanguage()->normalizeForSearch( $t ); $t = isset( $this->reservedWords[strtoupper( $t )] ) ? '{' . $t . '}' : $t; $t = preg_replace( '/^"(.*)"$/', '($1)', $t ); $t = preg_replace( '/([-&|])/', '\\\\$1', $t );