Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
dispatcher.php
1<?php
2
4
5use Bitrix;
6use Bitrix\Calendar\Core\Queue;
8
10{
11 public static function register()
12 {
13 Bitrix\Main\EventManager::getInstance()->addEventHandler(
14 'calendar',
15 RuleMaster::ON_QUEUE_PUSHED_EVENT_NAME,
16 [
17 self::class,
18 'handle'
19 ]
20 );
21 }
22
23 public static function handle(Bitrix\Main\Event $event)
24 {
25 if (
26 ($queue = $event->getParameter('queue'))
27 && ($queue instanceof Queue\Interfaces\Queue)
28 )
29 {
30 (new self())->wakeUpQueue($queue);
31 }
32 }
33
34 private function wakeUpQueue(Queue\Interfaces\Queue $queue)
35 {
36 if ($listener = $this->getRegistry()->getListenerByQueueId($queue->getQueueId()))
37 {
38 $listener->handle();
39 }
40 }
41
45 private function getRegistry(): Registry
46 {
47 return Registry::getInstance();
48 }
49}
static handle(Bitrix\Main\Event $event)