Remove duplicate private property from NotificationDeleteJob

Every job class does store it's properties in the $this->prop array
anyway.

Change-Id: Ib1c810ee367a2771e19fac25056c9e7bef22cb01
This commit is contained in:
Thiemo Kreuz 2019-06-05 17:54:58 +02:00 committed by Umherirrender
parent c10cc7e547
commit 048a9e84c1

View file

@ -13,19 +13,12 @@
*/
class EchoNotificationDeleteJob extends Job {
/**
* UserIds to be processed
* @var int[]
*/
protected $userIds = [];
/**
* @param Title $title
* @param array $params
*/
public function __construct( Title $title, array $params ) {
parent::__construct( __CLASS__, $title, $params );
$this->userIds = $params['userIds'];
}
/**
@ -34,10 +27,10 @@ class EchoNotificationDeleteJob extends Job {
*/
public function run() {
global $wgEchoMaxUpdateCount;
if ( count( $this->userIds ) > 1 ) {
if ( count( $this->params['userIds'] ) > 1 ) {
// If there are multiple users, queue a single job for each one
$jobs = [];
foreach ( $this->userIds as $userId ) {
foreach ( $this->params['userIds'] as $userId ) {
$jobs[] = new EchoNotificationDeleteJob( $this->title, [ 'userIds' => [ $userId ] ] );
}
JobQueueGroup::singleton()->push( $jobs );
@ -48,7 +41,7 @@ class EchoNotificationDeleteJob extends Job {
$notifMapper = new EchoNotificationMapper();
// Back-compat for older jobs which used array( $userId => $userId );
$userIds = array_values( $this->userIds );
$userIds = array_values( $this->params['userIds'] );
$userId = $userIds[0];
$user = User::newFromId( $userId );
$notif = $notifMapper->fetchByUserOffset( $user, $wgEchoMaxUpdateCount );