94 $config = RequestContext::getMain()->getConfig();
95 if ( !$config->get(
'EnotifWatchlist' ) && !$config->get(
'ShowUpdatedMarker' ) ) {
98 return MediaWikiServices::getInstance()->getWatchedItemStore()->updateNotificationTimestamp(
123 if ( $title->getNamespace() < 0 ) {
128 $config = RequestContext::getMain()->getConfig();
130 if ( $config->get(
'EnotifWatchlist' ) || $config->get(
'ShowUpdatedMarker' ) ) {
131 $watchers = MediaWikiServices::getInstance()->getWatchedItemStore()->updateNotificationTimestamp(
147 $isUserTalkPage = ( $title->getNamespace() ==
NS_USER_TALK );
167 'watchers' => $watchers,
192 # we use $wgPasswordSender as sender's address
197 # The following code is only run, if several conditions are met:
198 # 1. EmailNotification for pages (other than user_talk pages) must be enabled
199 # 2. minor edits (changes) are only regarded if the global flag indicates so
201 $isUserTalkPage = ( $title->getNamespace() ==
NS_USER_TALK );
209 $this->composed_common =
false;
212 $formattedPageStatus = [
'deleted',
'created',
'moved',
'restored',
'changed' ];
214 Hooks::run(
'UpdateUserMailerFormattedPageStatus', [ &$formattedPageStatus ] );
215 if ( !in_array( $this->pageStatus, $formattedPageStatus ) ) {
216 throw new MWException(
'Not a valid page status!' );
227 $this->
compose( $targetUser, self::USER_TALK );
228 $userTalkId = $targetUser->getId();
235 foreach ( $userArray as $watchingUser ) {
236 if ( $watchingUser->getOption(
'enotifwatchlistpages' )
237 && ( !
$minorEdit || $watchingUser->getOption(
'enotifminoredits' ) )
238 && $watchingUser->isEmailConfirmed()
239 && $watchingUser->getId() != $userTalkId
243 if ( Hooks::run(
'SendWatchlistEmailNotification', [ $watchingUser, $title, $this ] ) ) {
244 $this->
compose( $watchingUser, self::WATCHLIST );
257 $this->
compose( $user, self::ALL_CHANGES );
271 $isUserTalkPage = ( $title->getNamespace() ==
NS_USER_TALK );
276 if ( !$targetUser || $targetUser->isAnon() ) {
277 wfDebug( __METHOD__ .
": user talk page edited, but user does not exist\n" );
279 wfDebug( __METHOD__ .
": user edited their own talk page, no notification sent\n" );
281 wfDebug( __METHOD__ .
": talk page owner is blocked and cannot login, no notification sent\n" );
282 } elseif ( $targetUser->getOption(
'enotifusertalkpages' )
283 && ( !
$minorEdit || $targetUser->getOption(
'enotifminoredits' ) )
285 if ( !$targetUser->isEmailConfirmed() ) {
286 wfDebug( __METHOD__ .
": talk page owner doesn't have validated email\n" );
287 } elseif ( !Hooks::run(
'AbortTalkPageEmailNotification', [ $targetUser, $title ] ) ) {
288 wfDebug( __METHOD__ .
": talk page update notification is aborted for this user\n" );
290 wfDebug( __METHOD__ .
": sending talk page update notification\n" );
294 wfDebug( __METHOD__ .
": talk page owner doesn't want notifications\n" );
308 $this->composed_common =
true;
310 # You as the WikiAdmin and Sysops can make use of plenty of
311 # named variables when composing your notification emails while
312 # simply editing the Meta pages
315 $postTransformKeys = [];
316 $pageTitleUrl = $this->title->getCanonicalURL();
317 $pageTitle = $this->title->getPrefixedText();
319 if ( $this->oldid ) {
322 $this->title->getCanonicalURL( [
'diff' =>
'next',
'oldid' => $this->oldid ] ) )
323 ->inContentLanguage()->text();
329 $this->title->getCanonicalURL( [
'diff' =>
'0',
'oldid' => $this->oldid ] ) )
330 ->inContentLanguage()->text();
334 $keys[
'$CHANGEDORCREATED'] =
wfMessage(
'changed' )->inContentLanguage()->text();
336 # clear $OLDID placeholder in the message template
337 $keys[
'$OLDID'] =
'';
338 $keys[
'$NEWPAGE'] =
'';
340 $keys[
'$CHANGEDORCREATED'] =
wfMessage(
'created' )->inContentLanguage()->text();
343 $keys[
'$PAGETITLE'] = $this->title->getPrefixedText();
344 $keys[
'$PAGETITLE_URL'] = $this->title->getCanonicalURL();
345 $keys[
'$PAGEMINOREDIT'] =
"\n" . ( $this->minorEdit ?
346 wfMessage(
'enotif_minoredit' )->inContentLanguage()->text() :
'' );
347 $keys[
'$UNWATCHURL'] = $this->title->getCanonicalURL(
'action=unwatch' );
349 if ( $this->editor->isAnon() ) {
350 # real anon (user:xxx.xxx.xxx.xxx)
351 $keys[
'$PAGEEDITOR'] =
wfMessage(
'enotif_anon_editor', $this->editor->getName() )
352 ->inContentLanguage()->text();
353 $keys[
'$PAGEEDITOR_EMAIL'] =
wfMessage(
'noemailtitle' )->inContentLanguage()->text();
357 ? $this->editor->getRealName() : $this->editor->getName();
358 $emailPage = SpecialPage::getSafeTitleFor(
'Emailuser', $this->editor->getName() );
359 $keys[
'$PAGEEDITOR_EMAIL'] = $emailPage->getCanonicalURL();
362 $keys[
'$PAGEEDITOR_WIKI'] = $this->editor->getUserPage()->getCanonicalURL();
364 Skin::makeInternalOrExternalUrl(
wfMessage(
'helppage' )->inContentLanguage()->
text() )
367 # Replace this after transforming the message, T37019
368 $postTransformKeys[
'$PAGESUMMARY'] = $this->summary ==
'' ?
' - ' :
$this->summary;
375 $this->subject =
wfMessage(
'enotif_subject_' . $this->pageStatus )->inContentLanguage()
376 ->params( $pageTitle,
$keys[
'$PAGEEDITOR'] )->text();
381 $keys[
'$PAGEINTRO'] =
wfMessage(
'enotif_body_intro_' . $this->pageStatus )
382 ->inContentLanguage()->params( $pageTitle,
$keys[
'$PAGEEDITOR'], $pageTitleUrl )
387 $body = MessageCache::singleton()->transform(
$body,
false,
null, $this->title );
388 $this->body = wordwrap( strtr(
$body, $postTransformKeys ), 72 );
390 # Reveal the page editor's address as REPLY-TO address only if
391 # the user has not opted-out and the option is enabled at the
392 # global configuration level.
396 && ( $this->editor->getEmail() !=
'' )
397 && $this->editor->getOption(
'enotifrevealaddr' )
401 $this->from = $editorAddress;
403 $this->from = $adminAddress;
404 $this->replyto = $editorAddress;
407 $this->from = $adminAddress;
423 if ( !$this->composed_common ) {
427 if ( $wgEnotifImpersonal ) {
462 # $PAGEEDITDATE is the time and date of the page change
463 # expressed in terms of individual local time of the notification
464 # recipient, i.e. watching user
465 $contLang = MediaWikiServices::getInstance()->getContentLanguage();
467 [
'$WATCHINGUSERNAME',
471 ? $watchingUser->getRealName() : $watchingUser->getName(),
472 $contLang->userDate( $this->timestamp, $watchingUser ),
473 $contLang->userTime( $this->timestamp, $watchingUser ) ],
477 if (
$source === self::WATCHLIST ) {
478 $headers[
'List-Help'] =
'https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Watchlist';
482 'replyTo' => $this->replyto,
483 'headers' => $headers,
494 if ( empty( $addresses ) ) {
498 $contLang = MediaWikiServices::getInstance()->getContentLanguage();
500 [
'$WATCHINGUSERNAME',
503 [
wfMessage(
'enotif_impersonal_salutation' )->inContentLanguage()->
text(),
504 $contLang->date( $this->timestamp,
false,
false ),
505 $contLang->time( $this->timestamp,
false,
false ) ],
509 'replyTo' => $this->replyto,
This list may contain false positives That usually means there is additional text with links below the first Each row contains links to the first and second as well as the first line of the second redirect text
bool $wgEnotifRevealEditorAddress
Allow sending of e-mail notifications with the editor's address in "Reply-To".
$wgEnotifWatchlist
Allow users to enable email notification ("enotif") on watchlist changes.
bool $wgEnotifFromEditor
Allow sending of e-mail notifications with the editor's address as sender.
$wgEnotifUserTalk
Allow users to enable email notification ("enotif") when someone edits their user talk page.
$wgNoReplyAddress
Reply-To address for e-mail notifications.
$wgEnotifImpersonal
Send a generic mail instead of a personalised mail for each user.
$wgUsersNotifiedOnAllChanges
Array of usernames who will be sent a notification email for every change which occurs on a wiki.
$wgBlockDisablesLogin
If true, blocked users will not be allowed to login.
$wgEnotifMinorEdits
Potentially send notification mails on minor edits to pages.
$wgPasswordSender
Sender email address for e-mail notifications.
$wgEnotifUseRealName
Use real name instead of username in e-mail "from" field.
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
This module processes the email notifications when the current page is changed.
sendImpersonal( $addresses)
Same as sendPersonalised but does impersonal mail suitable for bulk mailing.
canSendUserTalkEmail( $editor, $title, $minorEdit)
const ALL_CHANGES
Notification because user is notified for all changes.
sendMails()
Send any queued mails.
notifyOnPageChange( $editor, $title, $timestamp, $summary, $minorEdit, $oldid=false, $pageStatus='changed')
Send emails corresponding to the user $editor editing the page $title.
sendPersonalised( $watchingUser, $source)
Does the per-user customizations to a notification e-mail (name, timestamp in proper timezone,...
compose( $user, $source)
Compose a mail to a given user and either queue it for sending, or send it now, depending on settings...
const WATCHLIST
Notification is due to a watchlisted page being edited.
actuallyNotifyOnPageChange( $editor, $title, $timestamp, $summary, $minorEdit, $oldid, $watchers, $pageStatus='changed')
Immediate version of notifyOnPageChange().
const USER_TALK
Notification is due to user's user talk being edited.
static updateWatchlistTimestamp(User $editor, LinkTarget $linkTarget, $timestamp)
composeCommonMailtext()
Generate the generic "this page has been changed" e-mail text.
Job for email notification mails.
Stores a single person's name and email address.
static newFromUser(User $user)
Create a new MailAddress object for the given user.
Represents a title within MediaWiki.
static send( $to, $from, $subject, $body, $options=[])
This function will perform a direct (authenticated) login to a SMTP Server to use for mail relaying i...
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
getName()
Get the user name, or the IP of an anonymous user.
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
isAllowed( $action='')
Internal mechanics of testing a permission.
getId()
Get the user's ID.
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<div ...>$1</div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services