X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fsearch%2FSearchDatabase.php;h=643c2c13648dc4381f538aa8f21bf4462957be6d;hb=91a920fd85c34e64f47140ed82f2ac0913ed8033;hp=5b18b7c82b5c6adadfa1460cde9ccad8501ec63b;hpb=67f06ab3678c9e685494506ff5ce85c57f0cc827;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/search/SearchDatabase.php b/includes/search/SearchDatabase.php index 5b18b7c82b..643c2c1364 100644 --- a/includes/search/SearchDatabase.php +++ b/includes/search/SearchDatabase.php @@ -21,6 +21,8 @@ * @ingroup Search */ +use Wikimedia\Rdbms\IDatabase; + /** * Base search engine base class for database-backed searches * @ingroup Search @@ -33,14 +35,13 @@ class SearchDatabase extends SearchEngine { protected $db; /** - * Constructor * @param IDatabase $db The database to search from */ public function __construct( IDatabase $db = null ) { if ( $db ) { $this->db = $db; } else { - $this->db = wfGetDB( DB_SLAVE ); + $this->db = wfGetDB( DB_REPLICA ); } } @@ -51,7 +52,10 @@ class SearchDatabase extends SearchEngine { * @return string */ protected function filter( $text ) { - $lc = $this->legalSearchChars(); + // List of chars allowed in the search query. + // This must include chars used in the search syntax. + // Usually " (phrase) or * (wildcards) if supported by the engine + $lc = $this->legalSearchChars( self::CHARS_ALL ); return trim( preg_replace( "/[^{$lc}]/", " ", $text ) ); } }