From 0870a69e67f1afdefbb777dacf0b081a330202c0 Mon Sep 17 00:00:00 2001 From: Brian Shaughnessy Date: Fri, 1 Jan 2016 11:29:15 -0500 Subject: [PATCH] CRM-17763 restore postEmailSend hook and create new postMailing hook --- CRM/Mailing/BAO/MailingJob.php | 2 +- CRM/Utils/Hook.php | 25 ++++++++++++++++++++----- CRM/Utils/Mail.php | 2 +- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/CRM/Mailing/BAO/MailingJob.php b/CRM/Mailing/BAO/MailingJob.php index 6aa979738d..4ec5fb4fbc 100644 --- a/CRM/Mailing/BAO/MailingJob.php +++ b/CRM/Mailing/BAO/MailingJob.php @@ -288,7 +288,7 @@ class CRM_Mailing_BAO_MailingJob extends CRM_Mailing_DAO_MailingJob { // CRM-17763 $details = CRM_Mailing_BAO_Mailing::report($job->mailing_id); - CRM_Utils_Hook::postEmailSend($details, 'civimail'); + CRM_Utils_Hook::postMailing($details); } } } diff --git a/CRM/Utils/Hook.php b/CRM/Utils/Hook.php index 9037c537bf..8a95d958ad 100644 --- a/CRM/Utils/Hook.php +++ b/CRM/Utils/Hook.php @@ -1557,19 +1557,34 @@ abstract class CRM_Utils_Hook { * The mailing parameters. Array fields include: groupName, from, toName, * toEmail, subject, cc, bcc, text, html, returnPath, replyTo, headers, * attachments (array) - * @param string $context - * Context of the mailing, either 'activity' or 'civimail' * * @return mixed */ - public static function postEmailSend(&$params, $context = '') { - return self::singleton()->invoke(2, $params, $context, - self::$_nullObject, self::$_nullObject, + public static function postEmailSend(&$params) { + return self::singleton()->invoke(1, $params, self::$_nullObject, self::$_nullObject, + self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_postEmailSend' ); } + /** + * This hook is called when a CiviMail mailing has completed + * + * @param array $report + * Output from: CRM_Mailing_BAO_Mailing::report() + * Includes details about the mailing, including stats to date, jobs, etc. + * + * @return mixed + */ + public static function postMailing($report) { + return self::singleton()->invoke(1, $report, + self::$_nullObject, self::$_nullObject, + self::$_nullObject, self::$_nullObject, self::$_nullObject, + 'civicrm_postMailing' + ); + } + /** * This hook is called when Settings specifications are loaded. * diff --git a/CRM/Utils/Mail.php b/CRM/Utils/Mail.php index a1cdda0d53..c940eddaaf 100644 --- a/CRM/Utils/Mail.php +++ b/CRM/Utils/Mail.php @@ -281,7 +281,7 @@ class CRM_Utils_Mail { return FALSE; } // CRM-10699 - CRM_Utils_Hook::postEmailSend($params, 'activity'); + CRM_Utils_Hook::postEmailSend($params); return TRUE; } return FALSE; -- 2.25.1