Standardized DB type checking

Change-Id: I374c0f9ce0e79181842f53fe9e5778e3fcdc1dcb
(cherry picked from commit 43b753b86d)
This commit is contained in:
Yaron Koren 2018-05-03 21:23:47 +00:00 committed by Cicalese
parent 42748d0d6d
commit 24f0ab9bad
2 changed files with 2 additions and 3 deletions

View file

@ -1,7 +1,6 @@
<?php
use Wikimedia\Rdbms\Database;
use Wikimedia\Rdbms\DatabasePostgres;
use Wikimedia\Rdbms\IResultWrapper;
class ReplaceTextSearch {
@ -79,7 +78,7 @@ class ReplaceTextSearch {
* @return string query condition for regex
*/
public static function regexCond( $dbr, $column, $regex ) {
if ( $dbr instanceof DatabasePostgres ) {
if ( $dbr->getType() == 'postgres' ) {
$op = '~';
} else {
$op = 'REGEXP';

View file

@ -427,7 +427,7 @@ class SpecialReplaceText extends SpecialPage {
// SQLite unfortunately lacks a REGEXP function or operator by
// default, so disable regex(p) searches for SQLite.
$dbr = wfGetDB( DB_REPLICA );
if ( ! $dbr instanceof Wikimedia\Rdbms\DatabaseSqlite ) {
if ( $dbr->getType() != 'sqlite' ) {
$out->addHTML( Xml::tags( 'p', null,
Xml::checkLabel(
$this->msg( 'replacetext_useregex' )->text(),