/
queue
executable file
·31 lines (27 loc) · 1.07 KB
/
queue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env php
<?php
/**
* Use as follows:
* $ queue -s <queue_gateway_id> -n <number of messages to be sent>
*
* E.g. to send 15 messages of source queue gateway ID 2, do this:
*
* $ queue -s 2 -n 15
*/
define('TL_MODE', 'FE');
define('TL_SCRIPT', 'system/modules/notification_center/bin/queue');
if (file_exists(__DIR__ . '/../../../initialize.php')) {
// Regular way
require_once(__DIR__ . '/../../../initialize.php');
} elseif (file_exists(__DIR__ . '/../../../../../system/initialize.php')) {
// Try composer location in Contao 3 (see #77)
require_once(__DIR__ . '/../../../../../system/initialize.php');
} elseif (file_exists(__DIR__ . '/../../../../system/initialize.php')) {
// Try composer location in Contao 4 (see #120)
require_once(__DIR__ . '/../../../../system/initialize.php');
} else {
throw new \RuntimeException('Contao initialize.php not found');
}
/** @var \NotificationCenter\Queue\QueueManager $queueManager */
$queueManager = $GLOBALS['NOTIFICATION_CENTER']['QUEUE_MANAGER'];
$queueManager->sendFromQueue($argv[2], $argv[4]);