Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
agent.php
1
<?php
2
3
namespace
Bitrix\Socialnetwork\Internals\LiveFeed\Counter\Queue
;
4
5
use
Bitrix\Socialnetwork\Internals\LiveFeed\Counter\CounterController
;
6
7
class
Agent
8
{
9
private
static
bool
$processing =
false
;
10
11
public
static
function
execute
()
12
{
13
if
(self::$processing)
14
{
15
return
self::getAgentName();
16
}
17
18
self::$processing =
true
;
19
20
$queue =
Queue::getInstance
();
21
$rows = $queue->get(
CounterController::STEP_LIMIT
);
22
23
if
(empty($rows))
24
{
25
self::$processing =
false
;
26
return
''
;
27
}
28
29
foreach
($rows as $row)
30
{
31
$userId = (int)$row[
'USER_ID'
];
32
(
new
CounterController
($userId))->processQueueItem($row);
33
}
34
35
$queue->done();
36
37
self::$processing =
false
;
38
39
return
self::getAgentName();
40
}
41
42
public
function
__construct
()
43
{
44
45
}
46
47
public
function
addAgent
(): void
48
{
49
$res = \CAgent::GetList(
50
[
'ID'
=>
'DESC'
],
51
[
52
'=NAME'
=> self::getAgentName()
53
]
54
);
55
if
($res->Fetch())
56
{
57
return
;
58
}
59
60
\CAgent::AddAgent(
61
self::getAgentName(),
62
'socialnetwork'
,
63
'N'
,
64
0,
65
''
,
66
'Y'
,
67
''
68
);
69
}
70
71
public
function
removeAgent
(): void
72
{
73
\CAgent::RemoveAgent(self::getAgentName(),
'socialnetwork'
);
74
}
75
76
private
static
function
getAgentName(): string
77
{
78
return
static::class .
"::execute();"
;
79
}
80
}
Bitrix\Socialnetwork\Internals\LiveFeed\Counter\CounterController
Definition
countercontroller.php:14
Bitrix\Socialnetwork\Internals\LiveFeed\Counter\CounterController\STEP_LIMIT
const STEP_LIMIT
Definition
countercontroller.php:17
Bitrix\Socialnetwork\Internals\LiveFeed\Counter\Queue\Agent
Definition
agent.php:8
Bitrix\Socialnetwork\Internals\LiveFeed\Counter\Queue\Agent\__construct
__construct()
Definition
agent.php:42
Bitrix\Socialnetwork\Internals\LiveFeed\Counter\Queue\Agent\removeAgent
removeAgent()
Definition
agent.php:71
Bitrix\Socialnetwork\Internals\LiveFeed\Counter\Queue\Agent\addAgent
addAgent()
Definition
agent.php:47
Bitrix\Socialnetwork\Internals\LiveFeed\Counter\Queue\Agent\execute
static execute()
Definition
agent.php:11
Bitrix\Socialnetwork\Internals\LiveFeed\Counter\Queue\Queue\getInstance
static getInstance()
Definition
queue.php:30
Bitrix\Socialnetwork\Internals\LiveFeed\Counter\Queue
Definition
agent.php:3
modules
socialnetwork
lib
internals
livefeed
counter
queue
agent.php
Создано системой
1.10.0