MediaWiki master
EmailNotification Class Reference

This module processes the email notifications when the current page is changed. More...

Collaboration diagram for EmailNotification:

Public Member Functions

 actuallyNotifyOnPageChange (Authority $editor, $title, $timestamp, $summary, $minorEdit, $oldid, $watchers, $pageStatus='changed')
 Immediate version of notifyOnPageChange().
 
 getPageStatus ()
 Extensions that have hooks for UpdateUserMailerFormattedPageStatus (to provide additional pageStatus indicators) need a way to make sure that, when their hook is called in SendWatchlistemailNotification, they only handle notifications using their pageStatus indicator.
 
 notifyOnPageChange (Authority $editor, $title, $timestamp, $summary, $minorEdit, $oldid=false, $pageStatus='changed')
 Send emails corresponding to the user $editor editing the page $title.
 

Protected Attributes

string $body = ''
 
bool $composed_common = false
 
User $editor
 
MailAddress $from
 
array MailAddress[] $mailTargets = []
 
bool $minorEdit
 
int null bool $oldid
 
string $pageStatus = ''
 
MailAddress $replyto
 
string $subject = ''
 
string $summary = ''
 
string $timestamp
 
Title $title
 

Detailed Description

This module processes the email notifications when the current page is changed.

It queries the watchlist table to find which users are watching that page.

The current implementation sends independent emails to each watching user for the following reason:

  • Each watching user will be notified about the page edit time expressed in his/her local time (UTC is shown additionally). To achieve this, we need to find the individual timeoffset of each watching user from the preferences.

Suggested improvement to reduce the number of sent emails: We could think of sending out bulk mails (bcc:user1,user2...) for all these users having the same timeoffset in their preferences.

Visit the documentation pages under https://www.mediawiki.org/wiki/Help:Watching_pages

TODO use UserOptionsLookup and other services, consider converting this to a service

Definition at line 59 of file EmailNotification.php.

Member Function Documentation

◆ actuallyNotifyOnPageChange()

EmailNotification::actuallyNotifyOnPageChange ( Authority  $editor,
  $title,
  $timestamp,
  $summary,
  $minorEdit,
  $oldid,
  $watchers,
  $pageStatus = 'changed' 
)

Immediate version of notifyOnPageChange().

Send emails corresponding to the user $editor editing the page $title.

Note
Do not call directly. Use notifyOnPageChange so that wl_notificationtimestamp is updated.
Parameters
Authority$editor
Title$title
string$timestampEdit timestamp
string$summaryEdit summary
bool$minorEdit
int$oldidRevision ID
array$watchersArray of user IDs
string$pageStatus

Definition at line 219 of file EmailNotification.php.

References MediaWiki\Title\Title\getNamespace(), MediaWiki\Title\Title\getText(), MediaWiki\Permissions\Authority\getUser(), MediaWiki\Permissions\Authority\isAllowed(), and NS_USER_TALK.

◆ getPageStatus()

EmailNotification::getPageStatus ( )

Extensions that have hooks for UpdateUserMailerFormattedPageStatus (to provide additional pageStatus indicators) need a way to make sure that, when their hook is called in SendWatchlistemailNotification, they only handle notifications using their pageStatus indicator.

Since
1.33
Returns
string

Definition at line 112 of file EmailNotification.php.

◆ notifyOnPageChange()

EmailNotification::notifyOnPageChange ( Authority  $editor,
  $title,
  $timestamp,
  $summary,
  $minorEdit,
  $oldid = false,
  $pageStatus = 'changed' 
)

Send emails corresponding to the user $editor editing the page $title.

May be deferred via the job queue.

Parameters
Authority$editor
Title$title
string$timestamp
string$summary
bool$minorEdit
bool$oldid(default: false)
string$pageStatus(default: 'changed')
Returns
bool Whether an email job was created or not.
Since
1.35 returns a boolean indicating whether an email job was created.

Definition at line 131 of file EmailNotification.php.

Member Data Documentation

◆ $body

string EmailNotification::$body = ''
protected

Definition at line 76 of file EmailNotification.php.

◆ $composed_common

bool EmailNotification::$composed_common = false
protected

Definition at line 91 of file EmailNotification.php.

◆ $editor

User EmailNotification::$editor
protected

Definition at line 100 of file EmailNotification.php.

◆ $from

MailAddress EmailNotification::$from
protected

Definition at line 80 of file EmailNotification.php.

◆ $mailTargets

array MailAddress [] EmailNotification::$mailTargets = []
protected

Definition at line 96 of file EmailNotification.php.

◆ $minorEdit

bool EmailNotification::$minorEdit
protected

Definition at line 86 of file EmailNotification.php.

◆ $oldid

int null bool EmailNotification::$oldid
protected

Definition at line 89 of file EmailNotification.php.

◆ $pageStatus

string EmailNotification::$pageStatus = ''
protected

Definition at line 93 of file EmailNotification.php.

◆ $replyto

MailAddress EmailNotification::$replyto
protected

Definition at line 78 of file EmailNotification.php.

◆ $subject

string EmailNotification::$subject = ''
protected

Definition at line 74 of file EmailNotification.php.

◆ $summary

string EmailNotification::$summary = ''
protected

Definition at line 84 of file EmailNotification.php.

◆ $timestamp

string EmailNotification::$timestamp
protected

Definition at line 82 of file EmailNotification.php.

◆ $title

Title EmailNotification::$title
protected

Definition at line 98 of file EmailNotification.php.


The documentation for this class was generated from the following file: