SpecialNuke: Don't add actor names WHERE if no names supplied

Why:

- If submitting the form with no conditions, the `$actornames` variable
  will be an array with a single empty string, which means the WHERE
  clause won't find any matches

What:

- Only add actor names to the WHERE clause if the array contains names
  to check

Bug: T342785
Change-Id: I7f407695583c1d7ebaf81d116578bd336adc5c7f
This commit is contained in:
Kosta Harlan 2024-10-21 16:09:15 +02:00
parent 98aa8d9942
commit 0923015f4a

View file

@ -454,9 +454,11 @@ class SpecialNuke extends SpecialPage {
if ( $username === '' ) {
$queryBuilder->field( 'actor_name', 'rc_user_text' );
} else {
$actornames = [ $username, ...$tempnames ];
$actornames = array_filter( [ $username, ...$tempnames ] );
if ( $actornames ) {
$queryBuilder->andWhere( [ 'actor_name' => $actornames ] );
}
}
if ( $namespace !== null ) {
$queryBuilder->andWhere( [ 'page_namespace' => $namespace ] );