Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
job.php
1<?php
10
15abstract class Job
16{
22 public static function actualizeByCampaignId($campaignId)
23 {
24 (new SenderJob())->withCampaignId($campaignId)->actualize();
25 (new ReiteratedJob())->actualize();
26 }
27
33 public static function actualizeByLetterId($letterId)
34 {
35 (new SenderJob())->withLetterId($letterId)->actualize();
36 (new ReiteratedJob())->actualize();
37 }
38
44 public static function actualizeAll()
45 {
46 (new SenderJob())->actualize();
47 (new ReiteratedJob())->actualize();
48 }
49
50 protected function addAgent($agentName, $interval = 60, $nextDateExec = '')
51 {
52 if (!$agentName || !is_string($agentName))
53 {
54 return;
55 }
56
57 $agent = new \CAllAgent();
58 $agent->AddAgent(
59 $agentName,
60 "sender",
61 "N",
62 (int) $interval,
63 null,
64 "Y",
65 (string) $nextDateExec
66 );
67 }
68
69 protected function removeAgent($agentName)
70 {
71 if (!$agentName || !is_string($agentName))
72 {
73 return;
74 }
75
76 $agent = new \CAllAgent();
77 $list = $agent->getList(
78 ["ID" => "DESC"],
79 ["MODULE_ID" => "sender", "NAME" => $agentName]
80 );
81 while ($row = $list->fetch())
82 {
83 $agent->delete($row["ID"]);
84 }
85 }
86
87 protected function agentExists($agentName)
88 {
89 if (!$agentName || !is_string($agentName))
90 {
91 return false;
92 }
93
94 $agent = new \CAllAgent();
95 return (bool)$agent->getList(
96 ["ID" => "DESC"],
97 ["MODULE_ID" => "sender", "NAME" => $agentName]
98 )->fetch();
99 }
100}
agentExists($agentName)
Definition job.php:87
static actualizeAll()
Definition job.php:44
addAgent($agentName, $interval=60, $nextDateExec='')
Definition job.php:50
static actualizeByCampaignId($campaignId)
Definition job.php:22
static actualizeByLetterId($letterId)
Definition job.php:33
removeAgent($agentName)
Definition job.php:69