1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
PeriodAgentTrait.php
См. документацию.
1<?php
2
3namespace Bitrix\Im\V2\Common;
4
6{
7 private static array $wasPeriodUpdated = [];
8
9 abstract protected static function isAgentPeriodShort(int $newPeriod): bool;
10
11 protected static function setPeriodByName(bool $fromAgent, string $agentName, callable $periodGetter): void
12 {
13 if (static::$wasPeriodUpdated[$agentName] ?? false)
14 {
15 return;
16 }
17
18 $period = $periodGetter();
19 self::setPeriod($period, $fromAgent, $agentName);
20 static::$wasPeriodUpdated[$agentName] = true;
21 }
22
23 protected static function setPeriod(int $period, bool $fromAgent, string $agentName): void
24 {
25 if ($fromAgent)
26 {
27 global $pPERIOD;
28 $pPERIOD = $period;
29
30 return;
31 }
32
33 if (!self::isAgentPeriodShort($period))
34 {
35 return;
36 }
37
38 $agent = \CAgent::GetList(
39 [],
40 [
41 "MODULE_ID" => "im",
42 "=NAME" => $agentName,
43 ]
44 )->Fetch();
45
46 if ($agent === false || $agent['ACTIVE'] === 'Y')
47 {
48 return;
49 }
50
51 \CAgent::Update(
52 (int)$agent['ID'],
53 ['NEXT_EXEC' => \ConvertTimeStamp(time() + \CTimeZone::GetOffset() + $period, 'FULL')]
54 );
55 }
56}
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
trait PeriodAgentTrait
Определения PeriodAgentTrait.php:6