MediaWiki master
EnotifNotifyJob.php
Go to the documentation of this file.
1<?php
24
31class EnotifNotifyJob extends Job {
32 public function __construct( Title $title, array $params ) {
33 parent::__construct( 'enotifNotify', $title, $params );
34 }
35
36 public function run() {
37 $enotif = new EmailNotification();
38 // Get the user from ID (rename safe). Anons are 0, so defer to name.
39 if ( isset( $this->params['editorID'] ) && $this->params['editorID'] ) {
40 $editor = User::newFromId( $this->params['editorID'] );
41 // B/C, only the name might be given.
42 } else {
43 # @todo FIXME: newFromName could return false on a badly configured wiki.
44 $editor = User::newFromName( $this->params['editor'], false );
45 }
46 if ( !array_key_exists( 'rc_id', $this->params ) ) {
47 $this->setLastError(
48 'Cannot execute EnotifNotifyJob without `rc_id`. This has to be an old job'
49 );
50 return true;
51 }
52 $recentChange = RecentChange::newFromId( $this->params['rc_id'] );
53 if ( $recentChange ) {
54 $enotif->actuallyNotifyOnPageChange(
55 $editor,
56 $this->title,
57 $recentChange,
58 $this->params['watchers'],
59 $this->params['pageStatus']
60 );
61 }
62 return true;
63 }
64}
Find watchers and create notifications after a page is changed.
Send an email notification.
__construct(Title $title, array $params)
run()
Run the job.
Describe and execute a background job.
Definition Job.php:41
setLastError( $error)
Definition Job.php:435
Represents a title within MediaWiki.
Definition Title.php:78
User class for the MediaWiki software.
Definition User.php:121