jenkins-bot has submitted this change and it was merged.

Change subject: Add hooks for EchoEvent's
......................................................................


Add hooks for EchoEvent's

BeforeEchoEventInsert can be used to abort or modify an
EchoEvent before it is created. If aborted, EchoEvent::create
will return false.
EchoEventInsertComplete can be used to run stuff once it's
been created.

Change-Id: I376708ac7aafc419bf87bceeff6de7de9bdc2f4e
---
M model/Event.php
1 file changed, 7 insertions(+), 1 deletion(-)

Approvals:
  Bsitu: Looks good to me, approved
  EBernhardson (WMF): Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/model/Event.php b/model/Event.php
index c820de4..9f5a096 100644
--- a/model/Event.php
+++ b/model/Event.php
@@ -78,7 +78,7 @@
         * extra: Event-specific extra information (e.g. post content)
         *
         * @throws MWException
-        * @return EchoEvent
+        * @return EchoEvent|bool false if aborted via hook
         */
        public static function create( $info = array() ) {
                global $wgEchoNotifications;
@@ -128,8 +128,14 @@
                        throw new MWException( "Invalid user parameter" );
                }
 
+               if ( !wfRunHooks( 'BeforeEchoEventInsert', array( $obj ) ) ) {
+                       return false;
+               }
+
                $obj->insert();
 
+               wfRunHooks( 'EchoEventInsertComplete', array( $obj ) );
+
                global $wgEchoUseJobQueue;
 
                EchoNotificationController::notify( $obj, $wgEchoUseJobQueue  );

-- 
To view, visit https://gerrit.wikimedia.org/r/86351
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I376708ac7aafc419bf87bceeff6de7de9bdc2f4e
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
Gerrit-Reviewer: Bsitu <[email protected]>
Gerrit-Reviewer: EBernhardson (WMF) <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to