MediaWiki  1.32.5
EmailNotification.php
Go to the documentation of this file.
1 <?php
27 
29 
50 
54  const USER_TALK = 'user_talk';
58  const WATCHLIST = 'watchlist';
62  const ALL_CHANGES = 'all_changes';
63 
64  protected $subject, $body, $replyto, $from;
66  protected $mailTargets = [];
67 
71  protected $title;
72 
76  protected $editor;
77 
88  public static function updateWatchlistTimestamp(
89  User $editor,
90  LinkTarget $linkTarget,
92  ) {
93  wfDeprecated( __METHOD__, '1.27' );
94  $config = RequestContext::getMain()->getConfig();
95  if ( !$config->get( 'EnotifWatchlist' ) && !$config->get( 'ShowUpdatedMarker' ) ) {
96  return [];
97  }
98  return MediaWikiServices::getInstance()->getWatchedItemStore()->updateNotificationTimestamp(
99  $editor,
100  $linkTarget,
101  $timestamp
102  );
103  }
104 
119  $minorEdit, $oldid = false, $pageStatus = 'changed'
120  ) {
122 
123  if ( $title->getNamespace() < 0 ) {
124  return;
125  }
126 
127  // update wl_notificationtimestamp for watchers
128  $config = RequestContext::getMain()->getConfig();
129  $watchers = [];
130  if ( $config->get( 'EnotifWatchlist' ) || $config->get( 'ShowUpdatedMarker' ) ) {
131  $watchers = MediaWikiServices::getInstance()->getWatchedItemStore()->updateNotificationTimestamp(
132  $editor,
133  $title,
134  $timestamp
135  );
136  }
137 
138  $sendEmail = true;
139  // $watchers deals with $wgEnotifWatchlist.
140  // If nobody is watching the page, and there are no users notified on all changes
141  // don't bother creating a job/trying to send emails, unless it's a
142  // talk page with an applicable notification.
143  if ( !count( $watchers ) && !count( $wgUsersNotifiedOnAllChanges ) ) {
144  $sendEmail = false;
145  // Only send notification for non minor edits, unless $wgEnotifMinorEdits
146  if ( !$minorEdit || ( $wgEnotifMinorEdits && !$editor->isAllowed( 'nominornewtalk' ) ) ) {
147  $isUserTalkPage = ( $title->getNamespace() == NS_USER_TALK );
148  if ( $wgEnotifUserTalk
149  && $isUserTalkPage
150  && $this->canSendUserTalkEmail( $editor, $title, $minorEdit )
151  ) {
152  $sendEmail = true;
153  }
154  }
155  }
156 
157  if ( $sendEmail ) {
158  JobQueueGroup::singleton()->lazyPush( new EnotifNotifyJob(
159  $title,
160  [
161  'editor' => $editor->getName(),
162  'editorID' => $editor->getId(),
163  'timestamp' => $timestamp,
164  'summary' => $summary,
165  'minorEdit' => $minorEdit,
166  'oldid' => $oldid,
167  'watchers' => $watchers,
168  'pageStatus' => $pageStatus
169  ]
170  ) );
171  }
172  }
173 
191  $oldid, $watchers, $pageStatus = 'changed' ) {
192  # we use $wgPasswordSender as sender's address
196 
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
200 
201  $isUserTalkPage = ( $title->getNamespace() == NS_USER_TALK );
202 
203  $this->title = $title;
204  $this->timestamp = $timestamp;
205  $this->summary = $summary;
206  $this->minorEdit = $minorEdit;
207  $this->oldid = $oldid;
208  $this->editor = $editor;
209  $this->composed_common = false;
210  $this->pageStatus = $pageStatus;
211 
212  $formattedPageStatus = [ 'deleted', 'created', 'moved', 'restored', 'changed' ];
213 
214  Hooks::run( 'UpdateUserMailerFormattedPageStatus', [ &$formattedPageStatus ] );
215  if ( !in_array( $this->pageStatus, $formattedPageStatus ) ) {
216  throw new MWException( 'Not a valid page status!' );
217  }
218 
219  $userTalkId = false;
220 
221  if ( !$minorEdit || ( $wgEnotifMinorEdits && !$editor->isAllowed( 'nominornewtalk' ) ) ) {
222  if ( $wgEnotifUserTalk
223  && $isUserTalkPage
224  && $this->canSendUserTalkEmail( $editor, $title, $minorEdit )
225  ) {
226  $targetUser = User::newFromName( $title->getText() );
227  $this->compose( $targetUser, self::USER_TALK );
228  $userTalkId = $targetUser->getId();
229  }
230 
231  if ( $wgEnotifWatchlist ) {
232  // Send updates to watchers other than the current editor
233  // and don't send to watchers who are blocked and cannot login
234  $userArray = UserArray::newFromIDs( $watchers );
235  foreach ( $userArray as $watchingUser ) {
236  if ( $watchingUser->getOption( 'enotifwatchlistpages' )
237  && ( !$minorEdit || $watchingUser->getOption( 'enotifminoredits' ) )
238  && $watchingUser->isEmailConfirmed()
239  && $watchingUser->getId() != $userTalkId
240  && !in_array( $watchingUser->getName(), $wgUsersNotifiedOnAllChanges )
241  && !( $wgBlockDisablesLogin && $watchingUser->isBlocked() )
242  ) {
243  if ( Hooks::run( 'SendWatchlistEmailNotification', [ $watchingUser, $title, $this ] ) ) {
244  $this->compose( $watchingUser, self::WATCHLIST );
245  }
246  }
247  }
248  }
249  }
250 
252  if ( $editor->getName() == $name ) {
253  // No point notifying the user that actually made the change!
254  continue;
255  }
257  $this->compose( $user, self::ALL_CHANGES );
258  }
259 
260  $this->sendMails();
261  }
262 
269  private function canSendUserTalkEmail( $editor, $title, $minorEdit ) {
271  $isUserTalkPage = ( $title->getNamespace() == NS_USER_TALK );
272 
273  if ( $wgEnotifUserTalk && $isUserTalkPage ) {
274  $targetUser = User::newFromName( $title->getText() );
275 
276  if ( !$targetUser || $targetUser->isAnon() ) {
277  wfDebug( __METHOD__ . ": user talk page edited, but user does not exist\n" );
278  } elseif ( $targetUser->getId() == $editor->getId() ) {
279  wfDebug( __METHOD__ . ": user edited their own talk page, no notification sent\n" );
280  } elseif ( $wgBlockDisablesLogin && $targetUser->isBlocked() ) {
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' ) )
284  ) {
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" );
289  } else {
290  wfDebug( __METHOD__ . ": sending talk page update notification\n" );
291  return true;
292  }
293  } else {
294  wfDebug( __METHOD__ . ": talk page owner doesn't want notifications\n" );
295  }
296  }
297  return false;
298  }
299 
303  private function composeCommonMailtext() {
307 
308  $this->composed_common = true;
309 
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
313 
314  $keys = [];
315  $postTransformKeys = [];
316  $pageTitleUrl = $this->title->getCanonicalURL();
317  $pageTitle = $this->title->getPrefixedText();
318 
319  if ( $this->oldid ) {
320  // Always show a link to the diff which triggered the mail. See T34210.
321  $keys['$NEWPAGE'] = "\n\n" . wfMessage( 'enotif_lastdiff',
322  $this->title->getCanonicalURL( [ 'diff' => 'next', 'oldid' => $this->oldid ] ) )
323  ->inContentLanguage()->text();
324 
325  if ( !$wgEnotifImpersonal ) {
326  // For personal mail, also show a link to the diff of all changes
327  // since last visited.
328  $keys['$NEWPAGE'] .= "\n\n" . wfMessage( 'enotif_lastvisited',
329  $this->title->getCanonicalURL( [ 'diff' => '0', 'oldid' => $this->oldid ] ) )
330  ->inContentLanguage()->text();
331  }
332  $keys['$OLDID'] = $this->oldid;
333  // Deprecated since MediaWiki 1.21, not used by default. Kept for backwards-compatibility.
334  $keys['$CHANGEDORCREATED'] = wfMessage( 'changed' )->inContentLanguage()->text();
335  } else {
336  # clear $OLDID placeholder in the message template
337  $keys['$OLDID'] = '';
338  $keys['$NEWPAGE'] = '';
339  // Deprecated since MediaWiki 1.21, not used by default. Kept for backwards-compatibility.
340  $keys['$CHANGEDORCREATED'] = wfMessage( 'created' )->inContentLanguage()->text();
341  }
342 
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' );
348 
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();
354 
355  } else {
356  $keys['$PAGEEDITOR'] = $wgEnotifUseRealName && $this->editor->getRealName() !== ''
357  ? $this->editor->getRealName() : $this->editor->getName();
358  $emailPage = SpecialPage::getSafeTitleFor( 'Emailuser', $this->editor->getName() );
359  $keys['$PAGEEDITOR_EMAIL'] = $emailPage->getCanonicalURL();
360  }
361 
362  $keys['$PAGEEDITOR_WIKI'] = $this->editor->getUserPage()->getCanonicalURL();
363  $keys['$HELPPAGE'] = wfExpandUrl(
364  Skin::makeInternalOrExternalUrl( wfMessage( 'helppage' )->inContentLanguage()->text() )
365  );
366 
367  # Replace this after transforming the message, T37019
368  $postTransformKeys['$PAGESUMMARY'] = $this->summary == '' ? ' - ' : $this->summary;
369 
370  // Now build message's subject and body
371 
372  // Messages:
373  // enotif_subject_deleted, enotif_subject_created, enotif_subject_moved,
374  // enotif_subject_restored, enotif_subject_changed
375  $this->subject = wfMessage( 'enotif_subject_' . $this->pageStatus )->inContentLanguage()
376  ->params( $pageTitle, $keys['$PAGEEDITOR'] )->text();
377 
378  // Messages:
379  // enotif_body_intro_deleted, enotif_body_intro_created, enotif_body_intro_moved,
380  // enotif_body_intro_restored, enotif_body_intro_changed
381  $keys['$PAGEINTRO'] = wfMessage( 'enotif_body_intro_' . $this->pageStatus )
382  ->inContentLanguage()->params( $pageTitle, $keys['$PAGEEDITOR'], $pageTitleUrl )
383  ->text();
384 
385  $body = wfMessage( 'enotif_body' )->inContentLanguage()->plain();
386  $body = strtr( $body, $keys );
387  $body = MessageCache::singleton()->transform( $body, false, null, $this->title );
388  $this->body = wordwrap( strtr( $body, $postTransformKeys ), 72 );
389 
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.
393  $adminAddress = new MailAddress( $wgPasswordSender,
394  wfMessage( 'emailsender' )->inContentLanguage()->text() );
396  && ( $this->editor->getEmail() != '' )
397  && $this->editor->getOption( 'enotifrevealaddr' )
398  ) {
399  $editorAddress = MailAddress::newFromUser( $this->editor );
400  if ( $wgEnotifFromEditor ) {
401  $this->from = $editorAddress;
402  } else {
403  $this->from = $adminAddress;
404  $this->replyto = $editorAddress;
405  }
406  } else {
407  $this->from = $adminAddress;
408  $this->replyto = new MailAddress( $wgNoReplyAddress );
409  }
410  }
411 
420  function compose( $user, $source ) {
421  global $wgEnotifImpersonal;
422 
423  if ( !$this->composed_common ) {
424  $this->composeCommonMailtext();
425  }
426 
427  if ( $wgEnotifImpersonal ) {
428  $this->mailTargets[] = MailAddress::newFromUser( $user );
429  } else {
430  $this->sendPersonalised( $user, $source );
431  }
432  }
433 
437  function sendMails() {
438  global $wgEnotifImpersonal;
439  if ( $wgEnotifImpersonal ) {
440  $this->sendImpersonal( $this->mailTargets );
441  }
442  }
443 
454  function sendPersonalised( $watchingUser, $source ) {
455  global $wgEnotifUseRealName;
456  // From the PHP manual:
457  // Note: The to parameter cannot be an address in the form of
458  // "Something <someone@example.com>". The mail command will not parse
459  // this properly while talking with the MTA.
460  $to = MailAddress::newFromUser( $watchingUser );
461 
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();
466  $body = str_replace(
467  [ '$WATCHINGUSERNAME',
468  '$PAGEEDITDATE',
469  '$PAGEEDITTIME' ],
470  [ $wgEnotifUseRealName && $watchingUser->getRealName() !== ''
471  ? $watchingUser->getRealName() : $watchingUser->getName(),
472  $contLang->userDate( $this->timestamp, $watchingUser ),
473  $contLang->userTime( $this->timestamp, $watchingUser ) ],
474  $this->body );
475 
476  $headers = [];
477  if ( $source === self::WATCHLIST ) {
478  $headers['List-Help'] = 'https://www.mediawiki.org/wiki/Special:MyLanguage/Help:Watchlist';
479  }
480 
481  return UserMailer::send( $to, $this->from, $this->subject, $body, [
482  'replyTo' => $this->replyto,
483  'headers' => $headers,
484  ] );
485  }
486 
493  function sendImpersonal( $addresses ) {
494  if ( empty( $addresses ) ) {
495  return null;
496  }
497 
498  $contLang = MediaWikiServices::getInstance()->getContentLanguage();
499  $body = str_replace(
500  [ '$WATCHINGUSERNAME',
501  '$PAGEEDITDATE',
502  '$PAGEEDITTIME' ],
503  [ wfMessage( 'enotif_impersonal_salutation' )->inContentLanguage()->text(),
504  $contLang->date( $this->timestamp, false, false ),
505  $contLang->time( $this->timestamp, false, false ) ],
506  $this->body );
507 
508  return UserMailer::send( $addresses, $this->from, $this->subject, $body, [
509  'replyTo' => $this->replyto,
510  ] );
511  }
512 
513 }
EmailNotification\$summary
$summary
Definition: EmailNotification.php:65
$user
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
Definition: hooks.txt:244
EmailNotification\composeCommonMailtext
composeCommonMailtext()
Generate the generic "this page has been changed" e-mail text.
Definition: EmailNotification.php:303
User\getId
getId()
Get the user's ID.
Definition: User.php:2437
EmailNotification\compose
compose( $user, $source)
Compose a mail to a given user and either queue it for sending, or send it now, depending on settings...
Definition: EmailNotification.php:420
$wgEnotifMinorEdits
$wgEnotifMinorEdits
Potentially send notification mails on minor edits to pages.
Definition: DefaultSettings.php:1814
EmailNotification\WATCHLIST
const WATCHLIST
Notification is due to a watchlisted page being edited.
Definition: EmailNotification.php:58
EmailNotification\notifyOnPageChange
notifyOnPageChange( $editor, $title, $timestamp, $summary, $minorEdit, $oldid=false, $pageStatus='changed')
Send emails corresponding to the user $editor editing the page $title.
Definition: EmailNotification.php:118
captcha-old.count
count
Definition: captcha-old.py:249
$wgUsersNotifiedOnAllChanges
$wgUsersNotifiedOnAllChanges
Array of usernames who will be sent a notification email for every change which occurs on a wiki.
Definition: DefaultSettings.php:1840
UserMailer\send
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...
Definition: UserMailer.php:114
$wgEnotifFromEditor
bool $wgEnotifFromEditor
Allow sending of e-mail notifications with the editor's address as sender.
Definition: DefaultSettings.php:1756
EmailNotification\sendMails
sendMails()
Send any queued mails.
Definition: EmailNotification.php:437
$wgEnotifWatchlist
$wgEnotifWatchlist
Allow users to enable email notification ("enotif") on watchlist changes.
Definition: DefaultSettings.php:1774
User\newFromName
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Definition: User.php:592
EmailNotification\$body
$body
Definition: EmailNotification.php:64
EmailNotification\updateWatchlistTimestamp
static updateWatchlistTimestamp(User $editor, LinkTarget $linkTarget, $timestamp)
Definition: EmailNotification.php:88
EmailNotification\$replyto
$replyto
Definition: EmailNotification.php:64
MailAddress\newFromUser
static newFromUser(User $user)
Create a new MailAddress object for the given user.
Definition: MailAddress.php:66
php
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
Definition: injection.txt:35
SpecialPage\getSafeTitleFor
static getSafeTitleFor( $name, $subpage=false)
Get a localised Title object for a page name with a possibly unvalidated subpage.
Definition: SpecialPage.php:111
MailAddress
Stores a single person's name and email address.
Definition: MailAddress.php:32
$wgEnotifUseRealName
$wgEnotifUseRealName
Use real name instead of username in e-mail "from" field.
Definition: DefaultSettings.php:1834
$wgNoReplyAddress
$wgNoReplyAddress
Reply-To address for e-mail notifications.
Definition: DefaultSettings.php:1654
MWException
MediaWiki exception.
Definition: MWException.php:26
wfDeprecated
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
Definition: GlobalFunctions.php:1118
Title\getNamespace
getNamespace()
Get the namespace index, i.e.
Definition: Title.php:974
EmailNotification\$oldid
$oldid
Definition: EmailNotification.php:65
use
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
Definition: MIT-LICENSE.txt:10
EmailNotification\$minorEdit
$minorEdit
Definition: EmailNotification.php:65
UserArray\newFromIDs
static newFromIDs( $ids)
Definition: UserArray.php:45
wfDebug
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Definition: GlobalFunctions.php:988
MessageCache\singleton
static singleton()
Get the signleton instance of this class.
Definition: MessageCache.php:120
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:302
$wgEnotifUserTalk
$wgEnotifUserTalk
Allow users to enable email notification ("enotif") when someone edits their user talk page.
Definition: DefaultSettings.php:1783
EmailNotification\$timestamp
$timestamp
Definition: EmailNotification.php:65
NS_USER_TALK
const NS_USER_TALK
Definition: Defines.php:67
EmailNotification\actuallyNotifyOnPageChange
actuallyNotifyOnPageChange( $editor, $title, $timestamp, $summary, $minorEdit, $oldid, $watchers, $pageStatus='changed')
Immediate version of notifyOnPageChange().
Definition: EmailNotification.php:190
EmailNotification\sendPersonalised
sendPersonalised( $watchingUser, $source)
Does the per-user customizations to a notification e-mail (name, timestamp in proper timezone,...
Definition: EmailNotification.php:454
title
title
Definition: parserTests.txt:239
$wgEnotifRevealEditorAddress
bool $wgEnotifRevealEditorAddress
Allow sending of e-mail notifications with the editor's address in "Reply-To".
Definition: DefaultSettings.php:1799
$wgBlockDisablesLogin
$wgBlockDisablesLogin
If true, blocked users will not be allowed to login.
Definition: DefaultSettings.php:5039
RequestContext\getMain
static getMain()
Get the RequestContext object associated with the main request.
Definition: RequestContext.php:434
text
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
Definition: All_system_messages.txt:1267
Title
Represents a title within MediaWiki.
Definition: Title.php:39
EmailNotification\canSendUserTalkEmail
canSendUserTalkEmail( $editor, $title, $minorEdit)
Definition: EmailNotification.php:269
JobQueueGroup\singleton
static singleton( $domain=false)
Definition: JobQueueGroup.php:69
EmailNotification\USER_TALK
const USER_TALK
Notification is due to user's user talk being edited.
Definition: EmailNotification.php:54
EmailNotification\$mailTargets
$mailTargets
Definition: EmailNotification.php:66
EmailNotification\sendImpersonal
sendImpersonal( $addresses)
Same as sendPersonalised but does impersonal mail suitable for bulk mailing.
Definition: EmailNotification.php:493
as
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
Definition: distributors.txt:9
from
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
Definition: APACHE-LICENSE-2.0.txt:43
EmailNotification\$title
Title $title
Definition: EmailNotification.php:71
$keys
$keys
Definition: testCompression.php:67
$source
$source
Definition: mwdoc-filter.php:46
$wgEnotifImpersonal
$wgEnotifImpersonal
Send a generic mail instead of a personalised mail for each user.
Definition: DefaultSettings.php:1823
EmailNotification\$editor
User $editor
Definition: EmailNotification.php:76
EmailNotification
This module processes the email notifications when the current page is changed.
Definition: EmailNotification.php:49
MediaWikiServices
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
Definition: injection.txt:23
MediaWiki\Linker\LinkTarget
Definition: LinkTarget.php:26
EmailNotification\$subject
$subject
Definition: EmailNotification.php:64
wfMessage
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 "&lt
$wgPasswordSender
$wgPasswordSender
Sender email address for e-mail notifications.
Definition: DefaultSettings.php:1647
EmailNotification\$composed_common
$composed_common
Definition: EmailNotification.php:65
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:47
EmailNotification\ALL_CHANGES
const ALL_CHANGES
Notification because user is notified for all changes.
Definition: EmailNotification.php:62
EnotifNotifyJob
Job for email notification mails.
Definition: EnotifNotifyJob.php:29
Hooks\run
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:200
User\getName
getName()
Get the user name, or the IP of an anonymous user.
Definition: User.php:2462
EmailNotification\$pageStatus
$pageStatus
Definition: EmailNotification.php:65
Title\getText
getText()
Get the text form (spaces not underscores) of the main part.
Definition: Title.php:933
EmailNotification\$from
$from
Definition: EmailNotification.php:64
Skin\makeInternalOrExternalUrl
static makeInternalOrExternalUrl( $name)
If url string starts with http, consider as external URL, else internal.
Definition: Skin.php:1195
wfExpandUrl
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
Definition: GlobalFunctions.php:512
User\isAllowed
isAllowed( $action='')
Internal mechanics of testing a permission.
Definition: User.php:3856