Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 18
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
BounceHandlerNotificationJob
0.00% covered (danger)
0.00%
0 / 18
0.00% covered (danger)
0.00%
0 / 2
20
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 run
0.00% covered (danger)
0.00%
0 / 17
0.00% covered (danger)
0.00%
0 / 1
12
1<?php
2
3namespace MediaWiki\Extension\BounceHandler;
4
5use Job;
6use MediaWiki\Title\Title;
7
8/**
9 * Class BounceHandlerNotificationJob
10 *
11 * Class to notify a global user on a particular wiki on his E-mail address becoming un-subscribed
12 *
13 * @file
14 * @ingroup JobQueue
15 * @author Tony Thomas
16 * @license GPL-2.0-or-later
17 */
18class BounceHandlerNotificationJob extends Job {
19    /** @inheritDoc */
20    public function __construct( Title $title, array $params ) {
21        parent::__construct( 'BounceHandlerNotificationJob', $title, $params );
22    }
23
24    /** @inheritDoc */
25    public function run() {
26        $failedUserId = $this->params['failed-user-id'];
27        $failedUserEmailAddress = $this->params['failed-email'];
28        $wikiId = $this->params['wikiId'];
29        $bounceRecordPeriod = $this->params['bounceRecordPeriod'];
30        $bounceRecordLimit = $this->params['bounceRecordLimit'];
31        $bounceHandlerUnconfirmUsers = $this->params['bounceHandlerUnconfirmUsers'];
32        $emailRaw = $this->params['emailRaw'];
33
34        if ( $failedUserEmailAddress && $failedUserId ) {
35            $unsubscribeNotification = new BounceHandlerActions(
36                $wikiId,
37                $bounceRecordPeriod,
38                $bounceRecordLimit,
39                $bounceHandlerUnconfirmUsers,
40                $emailRaw
41            );
42            $unsubscribeNotification->createEchoNotification( $failedUserId, $failedUserEmailAddress );
43        }
44
45        return true;
46    }
47}