1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
App.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\UI\Integration\Rest
;
4
5
use \Bitrix\Main;
6
use \Bitrix\Rest;
7
use \Bitrix\UI\Avatar\Mask;
8
use \Bitrix\UI\Avatar;
9
10
class
App
11
{
12
private
const
REST_STATISTIC_MASK_ENTITY_NAME =
'MASK'
;
13
14
public
static
function
onRestAppDelete
(
$app
)
15
{
16
if
(isset(
$app
[
'APP_ID'
])
17
&&
$app
[
'APP_ID'
]
18
&& (
$app
=
Rest
\
AppTable::getByClientId
(
$app
[
'APP_ID'
]))
19
)
20
{
21
try
22
{
23
(
new
Mask\Owner\RestApp
(
$app
[
'ID'
]))->
delete
();
24
if
(!Avatar\Model\ItemTable::getList([
'filter'
=> [
'=OWNER_TYPE'
=>
Mask
\
Owner
\RestApp::class],
'limit'
=> 1])->fetch())
25
{
26
\CAgent::RemoveAgent(__CLASS__ .
'::sendRestStatistic();'
,
'ui'
);
27
}
28
}
29
catch
(\Throwable $e)
30
{
31
// in case we do not
32
}
33
}
34
}
35
36
public
static
function
OnRestAppInstall
()
37
{
38
\CAgent::addAgent(
39
__CLASS__.
'::sendRestStatistic();'
,
40
'ui'
,
41
'N'
,
42
86400,
43
""
,
44
"Y"
,
45
""
,
46
100,
47
false
,
48
false
49
);
50
}
51
52
public
static
function
sendRestStatistic
()
53
{
54
if
(
55
Main
\Loader::includeModule(
'rest'
)
56
&& is_callable([
'\Bitrix\Rest\UsageStatTable'
,
'logUserInterface'
])
57
)
58
{
59
$dbRes
=
Avatar\Model\ItemToFileTable::getList
([
60
'select'
=> [
'APP_ID'
=>
'ITEM.OWNER_ID'
,
'CNT'
],
61
'filter'
=> [
62
'=ITEM.OWNER_TYPE'
=>
Mask
\
Owner
\RestApp::class,
63
],
64
'runtime'
=> [
new
Main
\
Entity
\
ExpressionField
(
'CNT'
,
'COUNT(%s)'
,
'ID'
)],
65
'group'
=> [
'ITEM.OWNER_ID'
],
66
]);
67
while
(
$res
=
$dbRes
->fetch())
68
{
69
Rest\UsageStatTable::logUserInterface
(
70
$res
[
'APP_ID'
],
71
static::REST_STATISTIC_MASK_ENTITY_NAME,
72
$res
[
'CNT'
]
73
);
74
}
75
Rest\UsageStatTable::finalize
();
76
}
77
78
return
__CLASS__ .
'::'
. __FUNCTION__ .
'();'
;
79
}
80
}
Bitrix\Main\ORM\Data\DataManager\getList
static getList(array $parameters=array())
Определения
datamanager.php:431
Bitrix\Main\ORM\Fields\ExpressionField
Определения
expressionfield.php:25
Bitrix\Rest\App
Определения
app.php:1313
Bitrix\Rest\AppTable\getByClientId
static getByClientId($clientId)
Определения
app.php:967
Bitrix\Rest\UsageStatTable\finalize
static finalize()
Определения
usagestat.php:374
Bitrix\Rest\UsageStatTable\logUserInterface
static logUserInterface($clientId, string $type, int $count=1)
Определения
usagestat.php:308
Bitrix\UI\Avatar\Mask\Owner\RestApp
Определения
RestApp.php:8
Bitrix\UI\Integration\Rest\App\sendRestStatistic
static sendRestStatistic()
Определения
App.php:52
Bitrix\UI\Integration\Rest\App\onRestAppDelete
static onRestAppDelete($app)
Определения
App.php:14
Bitrix\UI\Integration\Rest\App\OnRestAppInstall
static OnRestAppInstall()
Определения
App.php:36
$res
$res
Определения
filter_act.php:7
$app
$app
Определения
proxy.php:8
Bitrix\Main\Entity
Определения
ufield.php:9
Bitrix\Main\Rest
Определения
handlers.php:8
Bitrix\Main
Bitrix\UI\Avatar\Mask\Owner
Определения
DefaultOwner.php:2
Bitrix\UI\Avatar\Mask
Определения
Consumer.php:2
Bitrix\UI\Integration\Rest
Определения
App.php:3
$dbRes
$dbRes
Определения
yandex_detail.php:168
bitrix
modules
ui
lib
Integration
Rest
App.php
Создано системой
1.14.0