Handle invalid input to Special:FilePath?file=
[lhc/web/wiklou.git] / includes / search / SearchMssql.php
index 43bd3be..0e85f9d 100644 (file)
@@ -21,6 +21,9 @@
  * @ingroup Search
  */
 
+use MediaWiki\MediaWikiServices;
+use Wikimedia\Rdbms\IResultWrapper;
+
 /**
  * Search engine hook base class for Mssql (ConText).
  * @ingroup Search
@@ -32,7 +35,7 @@ class SearchMssql extends SearchDatabase {
         * @param string $term Raw search term
         * @return SqlSearchResultSet
         */
-       protected function doSearchText( $term ) {
+       protected function doSearchTextInDB( $term ) {
                $resultSet = $this->db->query( $this->getQuery( $this->filter( $term ), true ) );
                return new SqlSearchResultSet( $resultSet, $this->searchTerms );
        }
@@ -43,7 +46,7 @@ class SearchMssql extends SearchDatabase {
         * @param string $term Raw search term
         * @return SqlSearchResultSet
         */
-       protected function doSearchTitle( $term ) {
+       protected function doSearchTitleInDB( $term ) {
                $resultSet = $this->db->query( $this->getQuery( $this->filter( $term ), false ) );
                return new SqlSearchResultSet( $resultSet, $this->searchTerms );
        }
@@ -131,7 +134,6 @@ class SearchMssql extends SearchDatabase {
         * @return string
         */
        private function parseQuery( $filteredText, $fulltext ) {
-               global $wgContLang;
                $lc = $this->legalSearchChars( self::CHARS_NO_SYNTAX );
                $this->searchTerms = [];
 
@@ -142,7 +144,8 @@ class SearchMssql extends SearchDatabase {
                if ( preg_match_all( '/([-+<>~]?)(([' . $lc . ']+)(\*?)|"[^"]*")/',
                        $filteredText, $m, PREG_SET_ORDER ) ) {
                        foreach ( $m as $terms ) {
-                               $q[] = $terms[1] . $wgContLang->normalizeForSearch( $terms[2] );
+                               $q[] = $terms[1] . MediaWikiServices::getInstance()->getContentLanguage()->
+                                       normalizeForSearch( $terms[2] );
 
                                if ( !empty( $terms[3] ) ) {
                                        $regexp = preg_quote( $terms[3], '/' );
@@ -168,7 +171,7 @@ class SearchMssql extends SearchDatabase {
         * @param int $id
         * @param string $title
         * @param string $text
-        * @return bool|ResultWrapper
+        * @return bool|IResultWrapper
         */
        function update( $id, $title, $text ) {
                // We store the column data as UTF-8 byte order marked binary stream
@@ -191,7 +194,7 @@ class SearchMssql extends SearchDatabase {
         *
         * @param int $id
         * @param string $title
-        * @return bool|ResultWrapper
+        * @return bool|IResultWrapper
         */
        function updateTitle( $id, $title ) {
                $table = $this->db->tableName( 'searchindex' );