MediaWiki  master
EnotifNotifyJob.php
Go to the documentation of this file.
1 <?php
22 
28 class EnotifNotifyJob extends Job {
29  public function __construct( Title $title, array $params ) {
30  parent::__construct( 'enotifNotify', $title, $params );
31  }
32 
33  public function run() {
34  $enotif = new EmailNotification();
35  // Get the user from ID (rename safe). Anons are 0, so defer to name.
36  if ( isset( $this->params['editorID'] ) && $this->params['editorID'] ) {
37  $editor = User::newFromId( $this->params['editorID'] );
38  // B/C, only the name might be given.
39  } else {
40  # @todo FIXME: newFromName could return false on a badly configured wiki.
41  $editor = User::newFromName( $this->params['editor'], false );
42  }
43  $enotif->actuallyNotifyOnPageChange(
44  $editor,
45  $this->title,
46  $this->params['timestamp'],
47  $this->params['summary'],
48  $this->params['minorEdit'],
49  $this->params['oldid'],
50  $this->params['watchers'],
51  $this->params['pageStatus']
52  );
53 
54  return true;
55  }
56 }
This module processes the email notifications when the current page is changed.
Send an email notification.
__construct(Title $title, array $params)
run()
Run the job.
Class to both describe a background job and handle jobs.
Definition: Job.php:39
Title $title
Definition: Job.php:50
array $params
Array of job parameters.
Definition: Job.php:44
Represents a title within MediaWiki.
Definition: Title.php:82
static newFromName( $name, $validate='valid')
Definition: User.php:592
static newFromId( $id)
Static factory method for creation from a given user ID.
Definition: User.php:626