mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ReplaceText
synced 2024-12-18 17:23:11 +00:00
Merge "Standardized DB type checking" into REL1_31
This commit is contained in:
commit
a000d3157f
|
@ -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';
|
||||
|
|
|
@ -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