Skip to content
This repository has been archived by the owner on Jul 25, 2019. It is now read-only.

Commit

Permalink
Made email receiver configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
flemeur committed Aug 17, 2013
1 parent 5ff56b4 commit 3da01bf
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
6 changes: 5 additions & 1 deletion config/flamingsms.global.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ return array(
'gateway_classmap' => array(
'coolsms' => 'FlamingSms\SmsGateway\CoolSms',
'fakegw' => 'FlamingSms\SmsGateway\FakeGw',
)
),

'sms_queue' => array(
'default_email_receiver' => '[email protected]'
),
)
);
4 changes: 4 additions & 0 deletions config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@
'coolsms' => 'FlamingSms\SmsGateway\CoolSms',
'fakegw' => 'FlamingSms\SmsGateway\FakeGw',
),

'sms_queue' => array(
'default_email_receiver' => '[email protected]'
),

'gateway_config' => array(
'coolsms' => array(
Expand Down
15 changes: 13 additions & 2 deletions src/FlamingSms/Cli/SmsQueueController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class SmsQueueController extends AbstractCliController
* @var SmsService
*/
protected $smsService;

protected $emailReceiver;

public function runAction()
{
Expand Down Expand Up @@ -97,7 +99,7 @@ protected function runRegular($limit, $gatewayName = null, $forceGateway = null,


if ($sendMail && 0 < $smsCountTotal) {
$this->emailer()->sendMail('[email protected]',
$this->emailer()->sendMail($this->getEmailReceiver(),
'FlamingSms [' . $this->env() . '] - smsqueue run',
$output);
}
Expand Down Expand Up @@ -150,7 +152,7 @@ protected function cleanSmsQueue($gatewayName = null, $sendMail = false)
}

if ((0 < $sentCleanupCount || 0 < $queuedCleanupCount) && $sendMail) {
$this->emailer()->sendMail('[email protected]',
$this->emailer()->sendMail($this->getEmailReceiver(),
'FlamingSms [' . $this->env() . '] - smsqueue clean',
$output);
}
Expand Down Expand Up @@ -180,4 +182,13 @@ public function setSmsService(SmsService $smsService)
$this->smsService = $smsService;
return $this;
}

public function getEmailReceiver()
{
if (!$this->emailReceiver) {
$config = $this->getServiceLocator()->get('Configuration');
$this->emailReceiver = $config['flamingsms']['sms_queue']['default_email_receiver'];
}
return $this->emailReceiver;
}
}

0 comments on commit 3da01bf

Please sign in to comment.