MediaWiki  master
EnotifNotifyJob.php
Go to the documentation of this file.
1 <?php
26 class EnotifNotifyJob extends Job {
27  public function __construct( Title $title, array $params ) {
28  parent::__construct( 'enotifNotify', $title, $params );
29  }
30 
31  public function run() {
32  $enotif = new EmailNotification();
33  // Get the user from ID (rename safe). Anons are 0, so defer to name.
34  if ( isset( $this->params['editorID'] ) && $this->params['editorID'] ) {
35  $editor = User::newFromId( $this->params['editorID'] );
36  // B/C, only the name might be given.
37  } else {
38  # @todo FIXME: newFromName could return false on a badly configured wiki.
39  $editor = User::newFromName( $this->params['editor'], false );
40  }
41  $enotif->actuallyNotifyOnPageChange(
42  $editor,
43  $this->title,
44  $this->params['timestamp'],
45  $this->params['summary'],
46  $this->params['minorEdit'],
47  $this->params['oldid'],
48  $this->params['watchers'],
49  $this->params['pageStatus']
50  );
51 
52  return true;
53  }
54 }
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:52
static newFromName( $name, $validate='valid')
Definition: User.php:587
static newFromId( $id)
Static factory method for creation from a given user ID.
Definition: User.php:628