r55459 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55458‎ | r55459 | r55460 >
Date:23:33, 21 August 2009
Author:demon
Status:reverted (Comments)
Tags:
Comment:
(bug 15646) Page creation notification email is sent when a watched page is deleted
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/EnotifNotifyJob.php (modified) (history)
  • /trunk/phase3/includes/RecentChange.php (modified) (history)
  • /trunk/phase3/includes/UserMailer.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/RecentChange.php
@@ -196,7 +196,8 @@
197197 $this->mAttribs['rc_timestamp'],
198198 $this->mAttribs['rc_comment'],
199199 $this->mAttribs['rc_minor'],
200 - $this->mAttribs['rc_last_oldid'] );
 200+ $this->mAttribs['rc_last_oldid'],
 201+ $this->mAttribs['rc_deleted'] );
201202 }
202203 }
203204
Index: trunk/phase3/includes/EnotifNotifyJob.php
@@ -27,7 +27,8 @@
2828 $this->params['summary'],
2929 $this->params['minorEdit'],
3030 $this->params['oldid'],
31 - $this->params['watchers']
 31+ $this->params['watchers'],
 32+ $this->params['deleted'],
3233 );
3334 return true;
3435 }
Index: trunk/phase3/includes/UserMailer.php
@@ -281,7 +281,7 @@
282282 * @param $minorEdit
283283 * @param $oldid (default: false)
284284 */
285 - function notifyOnPageChange($editor, $title, $timestamp, $summary, $minorEdit, $oldid = false) {
 285+ function notifyOnPageChange($editor, $title, $timestamp, $summary, $minorEdit, $oldid = false, $deleted = false ) {
286286 global $wgEnotifUseJobQ, $wgEnotifWatchlist, $wgShowUpdatedMarker;
287287
288288 if ($title->getNamespace() < 0)
@@ -328,11 +328,13 @@
329329 "summary" => $summary,
330330 "minorEdit" => $minorEdit,
331331 "oldid" => $oldid,
332 - "watchers" => $watchers);
 332+ "watchers" => $watchers,
 333+ "deleted" => $deleted
 334+ );
333335 $job = new EnotifNotifyJob( $title, $params );
334336 $job->insert();
335337 } else {
336 - $this->actuallyNotifyOnPageChange( $editor, $title, $timestamp, $summary, $minorEdit, $oldid, $watchers );
 338+ $this->actuallyNotifyOnPageChange( $editor, $title, $timestamp, $summary, $minorEdit, $oldid, $watchers, $deleted );
337339 }
338340
339341 }
@@ -350,6 +352,7 @@
351353 * @param $minorEdit bool
352354 * @param $oldid int Revision ID
353355 * @param $watchers array of user IDs
 356+ * @param $deleted boolean If page was deleted
354357 */
355358 function actuallyNotifyOnPageChange($editor, $title, $timestamp, $summary, $minorEdit, $oldid, $watchers) {
356359 # we use $wgPasswordSender as sender's address
@@ -373,6 +376,7 @@
374377 $this->minorEdit = $minorEdit;
375378 $this->oldid = $oldid;
376379 $this->editor = $editor;
 380+ $this->deleted = $deleted;
377381 $this->composed_common = false;
378382
379383 $userTalkId = false;
@@ -450,6 +454,10 @@
451455 $keys['$NEWPAGE'] = wfMsgForContent( 'enotif_lastvisited', $difflink );
452456 $keys['$OLDID'] = $this->oldid;
453457 $keys['$CHANGEDORCREATED'] = wfMsgForContent( 'changed' );
 458+ } else if( $this->deleted ) {
 459+ $keys['$NEWPAGE'] = wfMsgForContent( 'enotif_deletedpagetext' );
 460+ $keys['$OLDID'] = '';
 461+ $keys['$CHANGEDORCREATED'] = wfMsgForContent( 'deleted' );
454462 } else {
455463 $keys['$NEWPAGE'] = wfMsgForContent( 'enotif_newpagetext' );
456464 # clear $OLDID placeholder in the message template
@@ -468,7 +476,8 @@
469477 $body = strtr( $body, $keys );
470478 $pagetitle = $this->title->getPrefixedText();
471479 $keys['$PAGETITLE'] = $pagetitle;
472 - $keys['$PAGETITLE_URL'] = $this->title->getFullUrl();
 480+ $keys['$REVINFO'] = $this->deleted ? '' :
 481+ wfMsgForContent( 'enotif_rev_info' $this->title->getFullUrl() );
473482
474483 $keys['$PAGEMINOREDIT'] = $medit;
475484 $keys['$PAGESUMMARY'] = $summary;
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -2585,14 +2585,17 @@
25862586 'enotif_impersonal_salutation' => '{{SITENAME}} user',
25872587 'changed' => 'changed',
25882588 'created' => 'created',
 2589+'deleted' => 'deleted',
 2590+'enotif_deletedpagetext' => 'This page is no longer available.',
25892591 'enotif_subject' => '{{SITENAME}} page $PAGETITLE has been $CHANGEDORCREATED by $PAGEEDITOR',
25902592 'enotif_lastvisited' => 'See $1 for all changes since your last visit.',
25912593 'enotif_lastdiff' => 'See $1 to view this change.',
25922594 'enotif_anon_editor' => 'anonymous user $1',
 2595+'enotif_rev_info' => 'See $1 for the current revision.',
25932596 'enotif_body' => 'Dear $WATCHINGUSERNAME,
25942597
25952598
2596 -The {{SITENAME}} page $PAGETITLE has been $CHANGEDORCREATED on $PAGEEDITDATE by $PAGEEDITOR, see $PAGETITLE_URL for the current revision.
 2599+The {{SITENAME}} page $PAGETITLE has been $CHANGEDORCREATED on $PAGEEDITDATE by $PAGEEDITOR. $REVINFO
25972600
25982601 $NEWPAGE
25992602
Index: trunk/phase3/RELEASE-NOTES
@@ -415,6 +415,8 @@
416416 * (bug 20296) Fixed an PHP warning in Language::getMagic() in PHP 5.3
417417 * When creating accounts, don't prefill name from current username (which
418418 presumably is already taken)
 419+* (bug 15646) Page creation notification email is not longer sent when a
 420+ watched page is deleted
419421
420422 == API changes in 1.16 ==
421423

Follow-up revisions

RevisionCommit summaryAuthorDate
r55467Follow-up r55459: Add new message keys to maintenance scriptraymond06:48, 22 August 2009
r55469Follow-up r55459: Fix for PHP Notice: Undefined variable: deleted in /var/www...raymond07:03, 22 August 2009
r56164Revert r55459, 55467, 55469, 55518 (Page creation notification email is sent ...demon01:04, 11 September 2009
r56172Rebuild all messages files. Follow-up to r56164 (revert r55459, 55467, 55469,...siebrand06:31, 11 September 2009

Comments

#Comment by Simetrical (talk | contribs)   03:42, 23 August 2009

RELEASE-NOTES typo fixed in r55518 (I should have noted the revision number in my commit message, oh well).

#Comment by Brion VIBBER (talk | contribs)   17:48, 10 September 2009

This will break if 'enotif_body' message has been customized, as one of the parameters no longer is being passed.

#Comment by Dnessett (talk | contribs)   20:49, 23 November 2009

Am I missing something? In UserMailer.php (revision 55459), actuallyNotifyOnPageChange() is called with a new $deleted parameter, but the function signature hasn't changed to accept the new parameter (even though the new comments suggest it does).

#Comment by 😂 (talk | contribs)   20:57, 23 November 2009

That was fixed in r55469, but the whole thing got reverted in r56164.

Status & tagging log