Skip to content

Commit c191f93

Browse files
authored
Merge pull request #19 from rozehnal/WEB-8635_emails
[WEB-8635] - Log emails for testing purposes when a email task is put into the queue
2 parents a510093 + 6e3d671 commit c191f93

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

Model/QueuedTask.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,21 @@ public function createJob($jobName, $data, $notBefore = null, $group = 'default'
4242
if ($notBefore != null) {
4343
$data['notbefore'] = date('Y-m-d H:i:s', strtotime($notBefore));
4444
}
45-
return ($this->save($this->create($data)));
45+
$createdData = $this->create($data);
46+
if (defined('EMAIL_LOG_ENABLED_VALUE') && EMAIL_LOG_ENABLED_VALUE == 2) {
47+
if (in_array($jobName, array('Notification', 'NotificationEmail', 'Email'))) {
48+
$data = unserialize($createdData['QueuedTask']['data']);
49+
$Shell = new Shell();
50+
$tasks = new TaskCollection($Shell);
51+
52+
$task = $tasks->load('queue' . $jobName);
53+
$task->run($data);
54+
55+
return true;
56+
}
57+
}
58+
59+
return $this->save($createdData);
4660
}
4761

4862
/**

0 commit comments

Comments
 (0)