(bug 15646) Page creation notification email is sent when a watched page is deleted
authorChad Horohoe <demon@users.mediawiki.org>
Fri, 21 Aug 2009 23:33:38 +0000 (23:33 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Fri, 21 Aug 2009 23:33:38 +0000 (23:33 +0000)
RELEASE-NOTES
includes/EnotifNotifyJob.php
includes/RecentChange.php
includes/UserMailer.php
languages/messages/MessagesEn.php

index 64fa73c..fdf2f45 100644 (file)
@@ -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 ==
 
index f7178d0..9a90f63 100644 (file)
@@ -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;
        }
index 2ca2f69..e3b8162 100644 (file)
@@ -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'] );
                }
        }
        
index b9f3597..b81f873 100644 (file)
@@ -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;
index 9c6521d..f23ba07 100644 (file)
@@ -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