1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
feedgarbagecollector.php
См. документацию.
1<?php
8
9namespace Bitrix\Socialnetwork\Update;
10
11use Bitrix\Main\Loader;
12use Bitrix\Socialnetwork\LogTable;
13use Bitrix\Main\Config\Option;
14
16{
17 private static $processing = false;
18
19 public static function execute()
20 {
21 if (self::$processing)
22 {
23 return self::getAgentName();
24 }
25
26 self::$processing = true;
27
28 $agent = new self();
29 $res = $agent->run();
30
31 self::$processing = false;
32
33 return $res;
34 }
35
39 private static function getAgentName(): string
40 {
41 return self::class . "::execute();";
42 }
43
44 private function __construct()
45 {
46
47 }
48
53 private function run(): string
54 {
55 $types = $this->getTypes();
56 if (empty($types))
57 {
58 return '';
59 }
60
61 $logIds = $this->getLogIds($types);
62 if (empty($logIds))
63 {
64 return '';
65 }
66
67 foreach ($logIds as $logId)
68 {
69 \CSocNetLog::Delete($logId);
70 }
71
72 return self::getAgentName();
73 }
74
82 private function getLogIds(array $types): array
83 {
84 $logIds = LogTable::getList([
85 'select' => ['ID'],
86 'filter' => [
87 '@ENTITY_TYPE' => $types,
88 ],
89 'limit' => $this->getLimit(),
90 ])->fetchAll();
91 if (empty($logIds))
92 {
93 return [];
94 }
95
96 return array_column($logIds, 'ID');
97 }
98
103 private function getTypes(): array
104 {
105 if (!Loader::includeModule('crm'))
106 {
107 return [];
108 }
109
110 return [
111 SONET_CRM_LEAD_ENTITY,
112 SONET_CRM_CONTACT_ENTITY,
113 SONET_CRM_COMPANY_ENTITY,
114 SONET_CRM_DEAL_ENTITY,
115 SONET_CRM_ACTIVITY_ENTITY,
116 SONET_CRM_INVOICE_ENTITY,
117 SONET_CRM_ORDER_ENTITY,
118 SONET_CRM_SUSPENDED_LEAD_ENTITY,
119 SONET_SUSPENDED_CRM_CONTACT_ENTITY,
120 SONET_SUSPENDED_CRM_COMPANY_ENTITY,
121 SONET_CRM_SUSPENDED_DEAL_ENTITY,
122 SONET_CRM_SUSPENDED_ACTIVITY_ENTITY,
123 ];
124 }
125
126 private function getLimit(): int
127 {
128 return (int)Option::get('socialnetwork', 'FeedGarbageCollectorAgentLimit', 20);
129 }
130}
static getList(array $parameters=array())
Определения datamanager.php:431
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$res
Определения filter_act.php:7