summaryrefslogtreecommitdiff
blob: b426f9bda6f3a65dc8cc054ae0ea90bd71e0cb9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php

use MediaWiki\MediaWikiServices;

class TranslateSandboxEmailJob extends Job {

	/**
	 * @param array $params
	 * @return self
	 */
	public static function newJob( array $params ) {
		return new self( Title::newMainPage(), $params );
	}

	/**
	 * @param Title $title
	 * @param array $params
	 */
	public function __construct( $title, $params ) {
		parent::__construct( __CLASS__, $title, $params );
	}

	public function run() {
		$services = MediaWikiServices::getInstance();
		$status = $services
			->getEmailer()
			->send(
				[ $this->params['to'] ],
				$this->params['from'],
				$this->params['subj'],
				$this->params['body'],
				null,
				[ 'replyTo' => $this->params['replyto'] ]
			);

		return $status->isOK();
	}
}