Skip to content

Commit

Permalink
Replace a raw query with expr()
Browse files Browse the repository at this point in the history
  • Loading branch information
lens0021 committed Sep 21, 2024
1 parent 8263374 commit ac7fd5a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions includes/HookHandlers/SpamEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,16 @@ public function onIsValidEmailAddr( $addr, &$result ) {
}

// Check email addresses of block users
$dbr = $this->loadBalancer->getConnection( DB_REPLICA );
$emails = array_filter( array_unique( array_map(
static function ( $block ) {
static function ( $block ) use ( $dbr ) {
$id = $block->getBlocker();
if ( $id ) {
return User::newFromIdentity( $id )->getEmail();
}
return null;
},
$this->databaseBlockStore->newListFromConds( [ 'bt_user IS NOT NULL' ] )
$this->databaseBlockStore->newListFromConds( [ $dbr->expr( 'bt_user', '!=', null ) ] )
) ) );
if ( in_array( $addr, $emails ) ) {
return false;
Expand Down

0 comments on commit ac7fd5a

Please sign in to comment.