r32274 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r32273‎ | r32274 | r32275 >
Date:00:39, 21 March 2008
Author:greg
Status:old
Tags:
Comment:
Don't call composeCommonMailtext() until we are sure we need to.
Modified paths:
  • /trunk/phase3/includes/UserMailer.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/UserMailer.php
@@ -257,7 +257,7 @@
258258 * @private
259259 */
260260 var $to, $subject, $body, $replyto, $from;
261 - var $user, $title, $timestamp, $summary, $minorEdit, $oldid;
 261+ var $user, $title, $timestamp, $summary, $minorEdit, $oldid, $composed_common, $editor;
262262 var $mailTargets = array();
263263
264264 /**@}}*/
@@ -331,7 +331,8 @@
332332 $this->summary = $summary;
333333 $this->minorEdit = $minorEdit;
334334 $this->oldid = $oldid;
335 - $this->composeCommonMailtext($editor);
 335+ $this->editor = $editor;
 336+ $this->composed_common = false;
336337
337338 $userTalkId = false;
338339
@@ -410,11 +411,13 @@
411412 /**
412413 * @private
413414 */
414 - function composeCommonMailtext($editor) {
 415+ function composeCommonMailtext() {
415416 global $wgEmergencyContact, $wgNoReplyAddress;
416417 global $wgEnotifFromEditor, $wgEnotifRevealEditorAddress;
417418 global $wgEnotifImpersonal;
418419
 420+ $this->composed_common = true;
 421+
419422 $summary = ($this->summary == '') ? ' - ' : $this->summary;
420423 $medit = ($this->minorEdit) ? wfMsg( 'minoredit' ) : '';
421424
@@ -464,6 +467,7 @@
465468 # Reveal the page editor's address as REPLY-TO address only if
466469 # the user has not opted-out and the option is enabled at the
467470 # global configuration level.
 471+ $editor = $this->editor;
468472 $name = $editor->getName();
469473 $adminAddress = new MailAddress( $wgEmergencyContact, 'WikiAdmin' );
470474 $editorAddress = new MailAddress( $editor );
@@ -513,6 +517,10 @@
514518 */
515519 function compose( $user ) {
516520 global $wgEnotifImpersonal;
 521+
 522+ if ( !$this->composed_common )
 523+ $this->composeCommonMailtext();
 524+
517525 if ( $wgEnotifImpersonal ) {
518526 $this->mailTargets[] = new MailAddress( $user );
519527 } else {

Status & tagging log