Use expression builder to avoid IDatabase::makeList

Bug: T350968
Change-Id: Iacb407a9aef293f401e0dbf754bb1f51f6b390c5
This commit is contained in:
Umherirrender 2024-07-21 17:18:31 +02:00
parent 2d418bb61c
commit e88494212e
2 changed files with 23 additions and 20 deletions

View file

@ -244,22 +244,23 @@ class QueryAbuseLog extends ApiQueryBase {
$key = $isGlobal ? 'global' : 'local';
$filterConds[$key][] = $filter[0];
}
$dbr = $this->getDB();
$conds = [];
if ( $filterConds['local'] ) {
$conds[] = $this->getDB()->makeList(
[ 'afl_global' => 0, 'afl_filter_id' => $filterConds['local'] ],
LIST_AND
);
$conds[] = $dbr->andExpr( [
'afl_global' => 0,
// @phan-suppress-previous-line PhanTypeMismatchArgument Array is non-empty
'afl_filter_id' => $filterConds['local'],
] );
}
if ( $filterConds['global'] ) {
$conds[] = $this->getDB()->makeList(
[ 'afl_global' => 1, 'afl_filter_id' => $filterConds['global'] ],
LIST_AND
);
$conds[] = $dbr->andExpr( [
'afl_global' => 1,
// @phan-suppress-previous-line PhanTypeMismatchArgument Array is non-empty
'afl_filter_id' => $filterConds['global'],
] );
}
$conds = $this->getDB()->makeList( $conds, LIST_OR );
$this->addWhere( $conds );
$this->addWhere( $dbr->orExpr( $conds ) );
}
if ( isset( $params['wiki'] ) ) {

View file

@ -579,18 +579,20 @@ class SpecialAbuseLog extends AbuseFilterSpecialPage {
}
$filterWhere = [];
if ( $filterConds['local'] ) {
$filterWhere[] = $dbr->makeList(
[ 'afl_global' => 0, 'afl_filter_id' => $filterConds['local'] ],
LIST_AND
);
$filterWhere[] = $dbr->andExpr( [
'afl_global' => 0,
// @phan-suppress-previous-line PhanTypeMismatchArgument Array is non-empty
'afl_filter_id' => $filterConds['local'],
] );
}
if ( $filterConds['global'] ) {
$filterWhere[] = $dbr->makeList(
[ 'afl_global' => 1, 'afl_filter_id' => $filterConds['global'] ],
LIST_AND
);
$filterWhere[] = $dbr->andExpr( [
'afl_global' => 1,
// @phan-suppress-previous-line PhanTypeMismatchArgument Array is non-empty
'afl_filter_id' => $filterConds['global'],
] );
}
$conds[] = $dbr->makeList( $filterWhere, LIST_OR );
$conds[] = $dbr->orExpr( $filterWhere );
}
$searchTitle = Title::newFromText( $this->mSearchTitle );