X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fsearch%2FSearchDatabase.php;h=643c2c13648dc4381f538aa8f21bf4462957be6d;hb=3ee52d10a2a28754daf0123021f2dc1db5ff39e6;hp=5b18b7c82b5c6adadfa1460cde9ccad8501ec63b;hpb=38ba6b620be9f6333d902055ae1c0c610af4985e;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 ) ); } }