From 3617ab6b5c207d0211a02b6dccacdfded8b7d7f1 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Fri, 21 Aug 2009 23:33:38 +0000 Subject: [PATCH] (bug 15646) Page creation notification email is sent when a watched page is deleted --- RELEASE-NOTES | 2 ++ includes/EnotifNotifyJob.php | 3 ++- includes/RecentChange.php | 3 ++- includes/UserMailer.php | 17 +++++++++++++---- languages/messages/MessagesEn.php | 5 ++++- 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 64fa73c156..fdf2f4588a 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -415,6 +415,8 @@ this. Was used when mwEmbed was going to be an extension. * (bug 20296) Fixed an PHP warning in Language::getMagic() in PHP 5.3 * When creating accounts, don't prefill name from current username (which presumably is already taken) +* (bug 15646) Page creation notification email is not longer sent when a + watched page is deleted == API changes in 1.16 == diff --git a/includes/EnotifNotifyJob.php b/includes/EnotifNotifyJob.php index f7178d0f38..9a90f63027 100644 --- a/includes/EnotifNotifyJob.php +++ b/includes/EnotifNotifyJob.php @@ -27,7 +27,8 @@ class EnotifNotifyJob extends Job { $this->params['summary'], $this->params['minorEdit'], $this->params['oldid'], - $this->params['watchers'] + $this->params['watchers'], + $this->params['deleted'], ); return true; } diff --git a/includes/RecentChange.php b/includes/RecentChange.php index 2ca2f69c6d..e3b8162581 100644 --- a/includes/RecentChange.php +++ b/includes/RecentChange.php @@ -196,7 +196,8 @@ class RecentChange $this->mAttribs['rc_timestamp'], $this->mAttribs['rc_comment'], $this->mAttribs['rc_minor'], - $this->mAttribs['rc_last_oldid'] ); + $this->mAttribs['rc_last_oldid'], + $this->mAttribs['rc_deleted'] ); } } diff --git a/includes/UserMailer.php b/includes/UserMailer.php index b9f359783e..b81f8739a5 100644 --- a/includes/UserMailer.php +++ b/includes/UserMailer.php @@ -281,7 +281,7 @@ class EmailNotification { * @param $minorEdit * @param $oldid (default: false) */ - function notifyOnPageChange($editor, $title, $timestamp, $summary, $minorEdit, $oldid = false) { + function notifyOnPageChange($editor, $title, $timestamp, $summary, $minorEdit, $oldid = false, $deleted = false ) { global $wgEnotifUseJobQ, $wgEnotifWatchlist, $wgShowUpdatedMarker; if ($title->getNamespace() < 0) @@ -328,11 +328,13 @@ class EmailNotification { "summary" => $summary, "minorEdit" => $minorEdit, "oldid" => $oldid, - "watchers" => $watchers); + "watchers" => $watchers, + "deleted" => $deleted + ); $job = new EnotifNotifyJob( $title, $params ); $job->insert(); } else { - $this->actuallyNotifyOnPageChange( $editor, $title, $timestamp, $summary, $minorEdit, $oldid, $watchers ); + $this->actuallyNotifyOnPageChange( $editor, $title, $timestamp, $summary, $minorEdit, $oldid, $watchers, $deleted ); } } @@ -350,6 +352,7 @@ class EmailNotification { * @param $minorEdit bool * @param $oldid int Revision ID * @param $watchers array of user IDs + * @param $deleted boolean If page was deleted */ function actuallyNotifyOnPageChange($editor, $title, $timestamp, $summary, $minorEdit, $oldid, $watchers) { # we use $wgPasswordSender as sender's address @@ -373,6 +376,7 @@ class EmailNotification { $this->minorEdit = $minorEdit; $this->oldid = $oldid; $this->editor = $editor; + $this->deleted = $deleted; $this->composed_common = false; $userTalkId = false; @@ -450,6 +454,10 @@ class EmailNotification { $keys['$NEWPAGE'] = wfMsgForContent( 'enotif_lastvisited', $difflink ); $keys['$OLDID'] = $this->oldid; $keys['$CHANGEDORCREATED'] = wfMsgForContent( 'changed' ); + } else if( $this->deleted ) { + $keys['$NEWPAGE'] = wfMsgForContent( 'enotif_deletedpagetext' ); + $keys['$OLDID'] = ''; + $keys['$CHANGEDORCREATED'] = wfMsgForContent( 'deleted' ); } else { $keys['$NEWPAGE'] = wfMsgForContent( 'enotif_newpagetext' ); # clear $OLDID placeholder in the message template @@ -468,7 +476,8 @@ class EmailNotification { $body = strtr( $body, $keys ); $pagetitle = $this->title->getPrefixedText(); $keys['$PAGETITLE'] = $pagetitle; - $keys['$PAGETITLE_URL'] = $this->title->getFullUrl(); + $keys['$REVINFO'] = $this->deleted ? '' : + wfMsgForContent( 'enotif_rev_info' $this->title->getFullUrl() ); $keys['$PAGEMINOREDIT'] = $medit; $keys['$PAGESUMMARY'] = $summary; diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 9c6521d91b..f23ba07770 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -2585,14 +2585,17 @@ Future changes to this page and its associated talk page will be listed there, a 'enotif_impersonal_salutation' => '{{SITENAME}} user', 'changed' => 'changed', 'created' => 'created', +'deleted' => 'deleted', +'enotif_deletedpagetext' => 'This page is no longer available.', 'enotif_subject' => '{{SITENAME}} page $PAGETITLE has been $CHANGEDORCREATED by $PAGEEDITOR', 'enotif_lastvisited' => 'See $1 for all changes since your last visit.', 'enotif_lastdiff' => 'See $1 to view this change.', 'enotif_anon_editor' => 'anonymous user $1', +'enotif_rev_info' => 'See $1 for the current revision.', 'enotif_body' => 'Dear $WATCHINGUSERNAME, -The {{SITENAME}} page $PAGETITLE has been $CHANGEDORCREATED on $PAGEEDITDATE by $PAGEEDITOR, see $PAGETITLE_URL for the current revision. +The {{SITENAME}} page $PAGETITLE has been $CHANGEDORCREATED on $PAGEEDITDATE by $PAGEEDITOR. $REVINFO $NEWPAGE -- 2.20.1