mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-23 21:53:35 +00:00
Use expression builder to avoid IDatabase::makeList
Bug: T350968 Change-Id: Iacb407a9aef293f401e0dbf754bb1f51f6b390c5
This commit is contained in:
parent
2d418bb61c
commit
e88494212e
|
@ -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'] ) ) {
|
||||
|
|
|
@ -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 );
|
||||
|
|
Loading…
Reference in a new issue