Merge "Standardized DB type checking" into REL1_31

This commit is contained in:
jenkins-bot 2018-05-07 03:26:09 +00:00 committed by Gerrit Code Review
commit a000d3157f
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 {
@ -84,7 +83,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(),