diff options
author | Umherirrender <umherirrender_de.wp@web.de> | 2024-06-29 22:31:02 +0200 |
---|---|---|
committer | Bartosz DziewoĆski <dziewonski@fastmail.fm> | 2024-07-11 15:29:20 +0000 |
commit | fc9e42823b3af43154ddccab5c438c824f571417 (patch) | |
tree | 1acbc9b9739e9a21ddd75ea378254ee33b6c5396 /maintenance/grep.php | |
parent | 74944d1a9d7a369e6c9a56fb2fa5a6e59bf66a5d (diff) | |
download | mediawikicore-fc9e42823b3af43154ddccab5c438c824f571417.tar.gz mediawikicore-fc9e42823b3af43154ddccab5c438c824f571417.zip |
rdbms: Create IReadableDatabase::andExpr() / ::orExpr()
Avoid the call to internal constructor of AndExpressionGroup and
OrExpressionGroup by creating a factory function similiar as the
IReadableDatabase::expr function for Expression objects.
This is also a replacement for calls to ISQLPlatform::makeList with
LIST_AND or LIST_OR argument to reduce passing sql as string to the
query builders.
Created two functions to allow the return type to be set for both
expression group to allow further calls of ->and() or ->or() on the
returned object.
Depending on the length of the array argument to makeList() it is
sometimes hard to see if the list gets converted to AND or OR, having
the operator in the function name makes it easier to read, so two
functions are helpful in this case as well.
Bug: T358961
Change-Id: Ica29689cbd0b111b099bb09b20845f85ae4c3376
Diffstat (limited to 'maintenance/grep.php')
-rw-r--r-- | maintenance/grep.php | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/maintenance/grep.php b/maintenance/grep.php index b6904ba8d6b3..4a20596537aa 100644 --- a/maintenance/grep.php +++ b/maintenance/grep.php @@ -7,7 +7,6 @@ use MediaWiki\Title\Title; use MediaWiki\WikiMap\WikiMap; use Wikimedia\Rdbms\IExpression; use Wikimedia\Rdbms\LikeValue; -use Wikimedia\Rdbms\OrExpressionGroup; require_once __DIR__ . '/Maintenance.php'; @@ -123,7 +122,7 @@ class GrepPages extends Maintenance { } $res = $dbr->newSelectQueryBuilder() ->queryInfo( WikiPage::getQueryInfo() ) - ->where( $orConds ? new OrExpressionGroup( ...$orConds ) : [] ) + ->where( $orConds ? $dbr->orExpr( $orConds ) : [] ) ->caller( __METHOD__ ) ->fetchResultSet(); foreach ( $res as $row ) { |