Go to the documentation of this file.
95 if ( !$config->get(
'EnotifWatchlist' ) && !$config->get(
'ShowUpdatedMarker' ) ) {
98 return MediaWikiServices::getInstance()->getWatchedItemStore()->updateNotificationTimestamp(
130 if ( $config->get(
'EnotifWatchlist' ) || $config->get(
'ShowUpdatedMarker' ) ) {
131 $watchers = MediaWikiServices::getInstance()->getWatchedItemStore()->updateNotificationTimestamp(
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
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 );
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'] = $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();
359 $keys[
'$PAGEEDITOR_EMAIL'] = $emailPage->getCanonicalURL();
362 $keys[
'$PAGEEDITOR_WIKI'] = $this->editor->getUserPage()->getCanonicalURL();
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 )
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 ) {
439 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
466 [
'$WATCHINGUSERNAME',
470 ? $watchingUser->getRealName() : $watchingUser->getName(),
471 $wgContLang->userDate( $this->timestamp, $watchingUser ),
472 $wgContLang->userTime( $this->timestamp, $watchingUser ) ],
476 if (
$source === self::WATCHLIST ) {
477 $headers[
'List-Help'] =
'https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Watchlist';
481 'replyTo' => $this->replyto,
482 'headers' => $headers,
495 if ( empty( $addresses ) ) {
500 [
'$WATCHINGUSERNAME',
503 [
wfMessage(
'enotif_impersonal_salutation' )->inContentLanguage()->
text(),
504 $wgContLang->date( $this->timestamp,
false,
false ),
505 $wgContLang->time( $this->timestamp,
false,
false ) ],
509 'replyTo' => $this->replyto,
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
composeCommonMailtext()
Generate the generic "this page has been changed" e-mail text.
getId()
Get the user's ID.
compose( $user, $source)
Compose a mail to a given user and either queue it for sending, or send it now, depending on settings...
$wgEnotifMinorEdits
Potentially send notification mails on minor edits to pages.
const WATCHLIST
Notification is due to a watchlisted page being edited.
notifyOnPageChange( $editor, $title, $timestamp, $summary, $minorEdit, $oldid=false, $pageStatus='changed')
Send emails corresponding to the user $editor editing the page $title.
$wgUsersNotifiedOnAllChanges
Array of usernames who will be sent a notification email for every change which occurs on a wiki.
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...
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
sendMails()
Send any queued mails.
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
$wgEnotifRevealEditorAddress
Set the Reply-to address in notifications to the editor's address, if user allowed this in the prefer...
$wgEnotifWatchlist
Allow users to enable email notification ("enotif") on watchlist changes.
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Allows to change the fields on the form that will be generated $name
static updateWatchlistTimestamp(User $editor, LinkTarget $linkTarget, $timestamp)
static newFromUser(User $user)
Create a new MailAddress object for the given user.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
static getSafeTitleFor( $name, $subpage=false)
Get a localised Title object for a page name with a possibly unvalidated subpage.
Stores a single person's name and email address.
to move a page</td >< td > &*You are moving the page across *A non empty talk page already exists under the new or *You uncheck the box below In those you will have to move or merge the page manually if desired</td >< td > be sure to &You are responsible for making sure that links continue to point where they are supposed to go Note that the page will &a page at the new title
$wgEnotifUseRealName
Use real name instead of username in e-mail "from" field.
$wgNoReplyAddress
Reply-To address for e-mail notifications.
getNamespace()
Get the namespace index, i.e.
when a variable name is used in a it is silently declared as a new masking the global
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
static singleton()
Get the signleton instance of this class.
$wgEnotifUserTalk
Allow users to enable email notification ("enotif") when someone edits their user talk page.
actuallyNotifyOnPageChange( $editor, $title, $timestamp, $summary, $minorEdit, $oldid, $watchers, $pageStatus='changed')
Immediate version of notifyOnPageChange().
sendPersonalised( $watchingUser, $source)
Does the per-user customizations to a notification e-mail (name, timestamp in proper timezone,...
$wgBlockDisablesLogin
If true, blocked users will not be allowed to login.
static getMain()
Static methods.
Represents a title within MediaWiki.
canSendUserTalkEmail( $editor, $title, $minorEdit)
$wgEnotifFromEditor
True: from page editor if s/he opted-in.
const USER_TALK
Notification is due to user's user talk being edited.
sendImpersonal( $addresses)
Same as sendPersonalised but does impersonal mail suitable for bulk mailing.
static singleton( $wiki=false)
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for and distribution as defined by Sections through of this document Licensor shall mean the copyright owner or entity authorized by the copyright owner that is granting the License Legal Entity shall mean the union of the acting entity and all other entities that control are controlled by or are under common control with that entity For the purposes of this definition control direct or to cause the direction or management of such whether by contract or including but not limited to software source documentation and configuration files Object form shall mean any form resulting from mechanical transformation or translation of a Source including but not limited to compiled object generated and conversions to other media types Work shall mean the work of whether in Source or Object made available under the as indicated by a copyright notice that is included in or attached to the whether in Source or Object that is based or other modifications as a an original work of authorship For the purposes of this Derivative Works shall not include works that remain separable from
$wgEnotifImpersonal
Send a generic mail instead of a personalised mail for each user.
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 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 "<
This module processes the email notifications when the current page is changed.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency MediaWikiServices
$wgPasswordSender
Sender email address for e-mail notifications.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
const ALL_CHANGES
Notification because user is notified for all changes.
Job for email notification mails.
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
getName()
Get the user name, or the IP of an anonymous user.
getText()
Get the text form (spaces not underscores) of the main part.
static makeInternalOrExternalUrl( $name)
If url string starts with http, consider as external URL, else internal.
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
isAllowed( $action='')
Internal mechanics of testing a permission.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the content language as $wgContLang