From 20aa01174c3e3569c6aff87238e672f65f31ed30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20Su=C3=A1rez?= Date: Tue, 10 May 2016 17:22:40 +0200 Subject: [PATCH] Add support to use Cc and Bcc in the notification system --- Mage/Command/BuiltIn/DeployCommand.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Mage/Command/BuiltIn/DeployCommand.php b/Mage/Command/BuiltIn/DeployCommand.php index 8dd6c9d..c97ae41 100644 --- a/Mage/Command/BuiltIn/DeployCommand.php +++ b/Mage/Command/BuiltIn/DeployCommand.php @@ -225,11 +225,11 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment if (self::$failedTasks === 0) { $exitCode = 0; } - + if (self::$deployStatus === self::FAILED) { $exitCode = 1; } - + return $exitCode; } @@ -590,6 +590,8 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment $projectName = $this->getConfig()->general('name', false); $projectEmail = $this->getConfig()->general('email', false); $notificationsEnabled = $this->getConfig()->general('notifications', false); + $ccEmail = $this->getConfig()->general('email_options.cc', null); + $bccEmail = $this->getConfig()->general('email_options.bcc', null); // We need notifications enabled, and a project name and email to send the notification if (!$projectName || !$projectEmail || !$notificationsEnabled) { @@ -600,8 +602,17 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment $mailer->setAddress($projectEmail) ->setProject($projectName) ->setLogFile(Console::getLogFile()) - ->setEnvironment($this->getConfig()->getEnvironment()) - ->send($result); + ->setEnvironment($this->getConfig()->getEnvironment()); + + if ($ccEmail) { + $mailer->setCc($ccEmail); + } + + if ($bccEmail) { + $mailer->setBcc($bccEmail); + } + + $mailer->send($result); return true; }