mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ReplaceText
synced 2024-12-18 17:23:11 +00:00
Standardized DB type checking
Change-Id: I374c0f9ce0e79181842f53fe9e5778e3fcdc1dcb
(cherry picked from commit 43b753b86d
)
This commit is contained in:
parent
42748d0d6d
commit
24f0ab9bad
|
@ -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';
|
||||
|
|
|
@ -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(),
|
||||
|
|
Loading…
Reference in a new issue