From: Andrew Garrett Date: Tue, 17 Jul 2012 19:58:53 +0000 (-0700) Subject: Allow extensions to abort (and replace) email notifications X-Git-Tag: 1.31.0-rc.0~23018^2 X-Git-Url: http://git.cyclocoop.org//%27http:/jquery.khurshid.com/ifixpng.php/%27?a=commitdiff_plain;h=e289e4231fd9d989f2cacf52251d1a4b1b9a445a;p=lhc%2Fweb%2Fwiklou.git Allow extensions to abort (and replace) email notifications Change-Id: I769ad24fcd6f3e3c03fb67122eab25a8472047b6 --- diff --git a/docs/hooks.txt b/docs/hooks.txt index 47654ce9df..5a836ae401 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -245,6 +245,10 @@ $block: The block from which the autoblock is coming. 'AbortDiffCache': Can be used to cancel the caching of a diff &$diffEngine: DifferenceEngine object +'AbortEmailNotification': Can be used to cancel email notifications for an edit. +$editor: The User who made the change. +$title: The Title of the page that was edited. + 'AbortLogin': Return false to cancel account login. $user: the User object being authenticated against $password: the password being submitted, not yet checked for validity diff --git a/includes/RecentChange.php b/includes/RecentChange.php index fb8e0224e2..20e7909a2a 100644 --- a/includes/RecentChange.php +++ b/includes/RecentChange.php @@ -231,13 +231,15 @@ class RecentChange { } $title = Title::makeTitle( $this->mAttribs['rc_namespace'], $this->mAttribs['rc_title'] ); - # @todo FIXME: This would be better as an extension hook - $enotif = new EmailNotification(); - $status = $enotif->notifyOnPageChange( $editor, $title, - $this->mAttribs['rc_timestamp'], - $this->mAttribs['rc_comment'], - $this->mAttribs['rc_minor'], - $this->mAttribs['rc_last_oldid'] ); + if ( wfRunHooks( 'AbortEmailNotification', array($editor, $title) ) ) { + # @todo FIXME: This would be better as an extension hook + $enotif = new EmailNotification(); + $status = $enotif->notifyOnPageChange( $editor, $title, + $this->mAttribs['rc_timestamp'], + $this->mAttribs['rc_comment'], + $this->mAttribs['rc_minor'], + $this->mAttribs['rc_last_oldid'] ); + } } }