MediaWiki master
EmailNotification Class Reference

Find watchers and create email notifications after a page is changed. More...

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 (RecentChange $recentChange)
 Send emails corresponding to the user $editor editing the page $title.
 

Protected Attributes

string $pageStatus = ''
 

Detailed Description

Find watchers and create email notifications after a page is changed.

After an edit is published to RCFeed, RecentChange::save calls EmailNotification. Here we query the watchlist table (via WatchedItemStore) to find who is watching a given page, format the emails in question, and dispatch emails to each of them via the JobQueue.

The current implementation sends independent emails to each watching user for the following reason: Each email mentions the page edit time expressed in the person's local time (UTC is shown additionally). To achieve this, we need to find the individual timeoffset of each watching user from the preferences.

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

Todo
If the volume becomes too great, we could send out bulk mails (bcc:user1,user2...) grouped by users having the same timeoffset in their preferences. This would however need to carefully consider impact of failure rate, re-try behaviour, and idempotence.
Todo
Use UserOptionsLookup and other services, consider converting this to a service
Since
1.11.0

Definition at line 61 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.
Since
1.11.0
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 186 of file EmailNotification.php.

References MediaWiki\User\Options\UserOptionsLookup\getOption(), 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 75 of file EmailNotification.php.

◆ notifyOnPageChange()

EmailNotification::notifyOnPageChange ( RecentChange $recentChange)

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

May be deferred via the job queue.

Since
1.11.0
1.35 returns a boolean indicating whether an email job was created.
1.44 This method takes just RecentChange $recentChange, instead of multiple parameters
Parameters
RecentChange$recentChange
Returns
bool Whether an email & notification job was created or not.

Definition at line 90 of file EmailNotification.php.

Member Data Documentation

◆ $pageStatus

string EmailNotification::$pageStatus = ''
protected

Definition at line 63 of file EmailNotification.php.


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

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant