From b5d183702fb4b1332e69a2499b8b8849295d32e6 Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Fri, 21 Mar 2008 00:39:32 +0000 Subject: [PATCH] Don't call composeCommonMailtext() until we are sure we need to. --- includes/UserMailer.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/includes/UserMailer.php b/includes/UserMailer.php index d043a6b59f..49784ba3e5 100644 --- a/includes/UserMailer.php +++ b/includes/UserMailer.php @@ -257,7 +257,7 @@ class EmailNotification { * @private */ var $to, $subject, $body, $replyto, $from; - var $user, $title, $timestamp, $summary, $minorEdit, $oldid; + var $user, $title, $timestamp, $summary, $minorEdit, $oldid, $composed_common, $editor; var $mailTargets = array(); /**@}}*/ @@ -331,7 +331,8 @@ class EmailNotification { $this->summary = $summary; $this->minorEdit = $minorEdit; $this->oldid = $oldid; - $this->composeCommonMailtext($editor); + $this->editor = $editor; + $this->composed_common = false; $userTalkId = false; @@ -410,11 +411,13 @@ class EmailNotification { /** * @private */ - function composeCommonMailtext($editor) { + function composeCommonMailtext() { global $wgEmergencyContact, $wgNoReplyAddress; global $wgEnotifFromEditor, $wgEnotifRevealEditorAddress; global $wgEnotifImpersonal; + $this->composed_common = true; + $summary = ($this->summary == '') ? ' - ' : $this->summary; $medit = ($this->minorEdit) ? wfMsg( 'minoredit' ) : ''; @@ -464,6 +467,7 @@ class EmailNotification { # Reveal the page editor's address as REPLY-TO address only if # the user has not opted-out and the option is enabled at the # global configuration level. + $editor = $this->editor; $name = $editor->getName(); $adminAddress = new MailAddress( $wgEmergencyContact, 'WikiAdmin' ); $editorAddress = new MailAddress( $editor ); @@ -513,6 +517,10 @@ class EmailNotification { */ function compose( $user ) { global $wgEnotifImpersonal; + + if ( !$this->composed_common ) + $this->composeCommonMailtext(); + if ( $wgEnotifImpersonal ) { $this->mailTargets[] = new MailAddress( $user ); } else { -- 2.20.1