userIds = $params['userIds']; } /** * Run the job of finding & deleting older notifications * @return true */ public function run() { global $wgEchoMaxUpdateCount; if ( count( $this->userIds ) > 1 ) { // If there are multiple users, queue a single job for each one $jobs = []; foreach ( $this->userIds as $userId ) { $jobs[] = new EchoNotificationDeleteJob( $this->title, [ 'userIds' => [ $userId ] ] ); } JobQueueGroup::singleton()->push( $jobs ); return true; } $notifMapper = new EchoNotificationMapper(); // Back-compat for older jobs which used array( $userId => $userId ); $userIds = array_values( $this->userIds ); $userId = $userIds[0]; $user = User::newFromId( $userId ); $notif = $notifMapper->fetchByUserOffset( $user, $wgEchoMaxUpdateCount ); if ( $notif ) { $notifMapper->deleteByUserEventOffset( $user, $notif->getEvent()->getId() ); $notifUser = MWEchoNotifUser::newFromUser( $user ); $notifUser->resetNotificationCount(); } return true; } }