Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 20 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| MailProcessor | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * |
| 5 | * @package Zmsmessaging |
| 6 | * |
| 7 | */ |
| 8 | |
| 9 | namespace BO\Zmsmessaging; |
| 10 | |
| 11 | use BO\Zmsmessaging\BaseController; |
| 12 | |
| 13 | require __DIR__ . '/../../vendor/autoload.php'; |
| 14 | require __DIR__ . '/../../bootstrap.php'; |
| 15 | |
| 16 | class MailProcessor extends Mail |
| 17 | { |
| 18 | public function __construct($verbose = false, $maxRunTime = 50) |
| 19 | { |
| 20 | parent::__construct($verbose, $maxRunTime); |
| 21 | ob_implicit_flush(true); // Enable implicit flushing |
| 22 | ob_end_flush(); // Flush output buffer |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | if ($argc > 2) { |
| 27 | $encodedIds = $argv[1]; |
| 28 | $action = $argv[2]; |
| 29 | $decodedAction = json_decode($action, true); |
| 30 | if (json_last_error() === JSON_ERROR_NONE) { |
| 31 | $action = $decodedAction; |
| 32 | } else { |
| 33 | $action = $action === 'false' ? false : ($action === 'true' ? true : $action); |
| 34 | } |
| 35 | $processor = new MailProcessor(); |
| 36 | $ids = json_decode(base64_decode($encodedIds), true); |
| 37 | try { |
| 38 | $results = $processor->sendQueueItems($action, $ids); |
| 39 | foreach ($results as $result) { |
| 40 | if (isset($result['errorInfo'])) { |
| 41 | $processor->log("Error processing mail item: " . $result['errorInfo']); |
| 42 | } |
| 43 | } |
| 44 | } catch (\Exception $exception) { |
| 45 | $processor->log("Error processing batch: " . $exception->getMessage()); |
| 46 | } |
| 47 | } |