MediaWiki  1.23.6
EmailNotification Class Reference

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

Collaboration diagram for EmailNotification:

Public Member Functions

 actuallyNotifyOnPageChange ( $editor, $title, $timestamp, $summary, $minorEdit, $oldid, $watchers, $pageStatus='changed')
 Immediate version of notifyOnPageChange(). More...
 
 compose ( $user)
 Compose a mail to a given user and either queue it for sending, or send it now, depending on settings. More...
 
 notifyOnPageChange ( $editor, $title, $timestamp, $summary, $minorEdit, $oldid=false, $pageStatus='changed')
 Send emails corresponding to the user $editor editing the page $title. More...
 
 sendImpersonal ( $addresses)
 Same as sendPersonalised but does impersonal mail suitable for bulk mailing. More...
 
 sendMails ()
 Send any queued mails. More...
 

Public Attributes

 $body
 
 $composed_common
 
 $from
 
 $minorEdit
 
 $oldid
 
 $pageStatus
 
 $replyto
 
 $summary
 

Protected Attributes

User $editor
 
 $mailTargets = array()
 
 $subject
 
 $timestamp
 
Title $title
 

Private Member Functions

 canSendUserTalkEmail ( $editor, $title, $minorEdit)
 
 composeCommonMailtext ()
 Generate the generic "this page has been changed" e-mail text. More...
 
 sendPersonalised ( $watchingUser)
 Does the per-user customizations to a notification e-mail (name, timestamp in proper timezone, etc) and sends it out. More...
 

Detailed Description

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

It looks up the table watchlist to find out 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 slack down 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 http://meta.wikipedia.com/Enotif

Definition at line 475 of file UserMailer.php.

Member Function Documentation

◆ actuallyNotifyOnPageChange()

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

Immediate version of notifyOnPageChange().

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

Parameters
$editorUser object
$titleTitle object
string$timestampEdit timestamp
string$summaryEdit summary
$minorEditbool
int$oldidRevision ID
array$watchersof user IDs
string$pageStatus
Exceptions
MWException

Definition at line 599 of file UserMailer.php.

References $editor, $minorEdit, $name, $oldid, $pageStatus, $summary, $timestamp, $title, $user, array(), as, canSendUserTalkEmail(), compose(), User\getName(), Title\getNamespace(), Title\getText(), global, User\isAllowed(), UserArray\newFromIDs(), User\newFromName(), NS_USER_TALK, sendMails(), title, wfProfileIn(), wfProfileOut(), and wfRunHooks().

Referenced by notifyOnPageChange().

◆ canSendUserTalkEmail()

EmailNotification::canSendUserTalkEmail (   $editor,
  $title,
  $minorEdit 
)
private
Parameters
$editorUser
$titleTitle bool
$minorEdit
Returns
bool

Definition at line 677 of file UserMailer.php.

References $editor, $minorEdit, $title, array(), User\getId(), Title\getNamespace(), Title\getText(), global, User\newFromName(), NS_USER_TALK, wfDebug(), and wfRunHooks().

Referenced by actuallyNotifyOnPageChange(), and notifyOnPageChange().

◆ compose()

EmailNotification::compose (   $user)

Compose a mail to a given user and either queue it for sending, or send it now, depending on settings.

Call sendMails() to send any mails that were queued.

Parameters
$userUser

Definition at line 822 of file UserMailer.php.

References $user, composeCommonMailtext(), global, and sendPersonalised().

Referenced by actuallyNotifyOnPageChange().

◆ composeCommonMailtext()

EmailNotification::composeCommonMailtext ( )
private

Generate the generic "this page has been changed" e-mail text.

Definition at line 709 of file UserMailer.php.

References $body, $keys, $oldid, $summary, array(), from, SpecialPage\getSafeTitleFor(), global, Skin\makeInternalOrExternalUrl(), MessageCache\singleton(), text, title, wfExpandUrl(), and wfMessage().

Referenced by compose().

◆ notifyOnPageChange()

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

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

Also updates wl_notificationtimestamp.

May be deferred via the job queue.

Parameters
$editorUser object
$titleTitle object
$timestamp
$summary
$minorEdit
$oldid(default: false)
$pageStatus(default: 'changed')

Definition at line 502 of file UserMailer.php.

References $editor, $fname, $job, $minorEdit, $oldid, $pageStatus, $params, $res, $summary, $timestamp, $title, actuallyNotifyOnPageChange(), array(), as, canSendUserTalkEmail(), DB_MASTER, Title\getDBkey(), User\getName(), Title\getNamespace(), global, User\isAllowed(), NS_USER_TALK, JobQueueGroup\singleton(), and wfGetDB().

◆ sendImpersonal()

EmailNotification::sendImpersonal (   $addresses)

Same as sendPersonalised but does impersonal mail suitable for bulk mailing.

Takes an array of MailAddress objects.

Parameters
$addressesarray
Returns
Status|null

Definition at line 883 of file UserMailer.php.

References $body, $wgContLang, array(), from, global, UserMailer\send(), text, and wfMessage().

Referenced by sendMails().

◆ sendMails()

EmailNotification::sendMails ( )

Send any queued mails.

Definition at line 839 of file UserMailer.php.

References global, and sendImpersonal().

Referenced by actuallyNotifyOnPageChange().

◆ sendPersonalised()

EmailNotification::sendPersonalised (   $watchingUser)
private

Does the per-user customizations to a notification e-mail (name, timestamp in proper timezone, etc) and sends it out.

Returns true if the mail was sent successfully.

Parameters
$watchingUserUser object
Returns
Boolean

Definition at line 855 of file UserMailer.php.

References $body, $wgContLang, array(), from, global, and UserMailer\send().

Referenced by compose().

Member Data Documentation

◆ $body

EmailNotification::$body

Definition at line 476 of file UserMailer.php.

Referenced by composeCommonMailtext(), sendImpersonal(), and sendPersonalised().

◆ $composed_common

EmailNotification::$composed_common

Definition at line 477 of file UserMailer.php.

◆ $editor

User EmailNotification::$editor
protected

◆ $from

EmailNotification::$from

Definition at line 476 of file UserMailer.php.

◆ $mailTargets

EmailNotification::$mailTargets = array()
protected

Definition at line 478 of file UserMailer.php.

◆ $minorEdit

EmailNotification::$minorEdit

◆ $oldid

EmailNotification::$oldid

◆ $pageStatus

EmailNotification::$pageStatus

Definition at line 477 of file UserMailer.php.

Referenced by actuallyNotifyOnPageChange(), and notifyOnPageChange().

◆ $replyto

EmailNotification::$replyto

Definition at line 476 of file UserMailer.php.

◆ $subject

EmailNotification::$subject
protected

Definition at line 476 of file UserMailer.php.

◆ $summary

EmailNotification::$summary

◆ $timestamp

EmailNotification::$timestamp
protected

Definition at line 477 of file UserMailer.php.

Referenced by actuallyNotifyOnPageChange(), and notifyOnPageChange().

◆ $title

Title EmailNotification::$title
protected

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