X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fsearch%2FSearchDatabase.php;h=5b18b7c82b5c6adadfa1460cde9ccad8501ec63b;hb=9987c2274d2f9051f32053d9354810acce91d3f7;hp=e3aafe86798b97db5d0aa4673ab0b2e514b26dc0;hpb=be7ee7d714b63f8bf5c07944b7eab9f6af2d9a1d;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/search/SearchDatabase.php b/includes/search/SearchDatabase.php index e3aafe8679..5b18b7c82b 100644 --- a/includes/search/SearchDatabase.php +++ b/includes/search/SearchDatabase.php @@ -28,19 +28,30 @@ */ class SearchDatabase extends SearchEngine { /** - * @var DatabaseBase Slave database for reading from for results + * @var IDatabase Slave database for reading from for results */ protected $db; /** * Constructor - * @param DatabaseBase $db The database to search from + * @param IDatabase $db The database to search from */ - public function __construct( DatabaseBase $db = null ) { + public function __construct( IDatabase $db = null ) { if ( $db ) { $this->db = $db; } else { $this->db = wfGetDB( DB_SLAVE ); } } + + /** + * Return a 'cleaned up' search string + * + * @param string $text + * @return string + */ + protected function filter( $text ) { + $lc = $this->legalSearchChars(); + return trim( preg_replace( "/[^{$lc}]/", " ", $text ) ); + } }