Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
log.php
1
<?php
2
namespace
Bitrix\Seo\Adv
;
3
4
use
Bitrix\Main\Application
;
5
use
Bitrix\Main\Entity
;
6
use
Bitrix\Main\Type\DateTime
;
7
use
Bitrix\Main\Web\HttpClient
;
8
use
Bitrix\Seo\Engine
;
9
41
class
LogTable
extends
Entity\DataManager
42
{
43
const
TTL
= 604800;
// one week
44
50
public
static
function
getTableName
()
51
{
52
return
'b_seo_adv_log'
;
53
}
54
60
public
static
function
getMap
()
61
{
62
return
array(
63
'ID'
=> array(
64
'data_type'
=>
'integer'
,
65
'primary'
=>
true
,
66
'autocomplete'
=>
true
,
67
),
68
'ENGINE_ID'
=> array(
69
'data_type'
=>
'integer'
,
70
'required'
=>
true
,
71
),
72
'TIMESTAMP_X'
=> array(
73
'data_type'
=>
'datetime'
,
74
'required'
=>
true
,
75
),
76
'REQUEST_URI'
=> array(
77
'data_type'
=>
'string'
,
78
'required'
=>
true
,
79
),
80
'REQUEST_DATA'
=> array(
81
'data_type'
=>
'text'
,
82
'required'
=>
true
,
83
),
84
'RESPONSE_TIME'
=> array(
85
'data_type'
=>
'float'
,
86
'required'
=>
true
,
87
),
88
'RESPONSE_STATUS'
=> array(
89
'data_type'
=>
'integer'
,
90
'required'
=>
true
,
91
),
92
'RESPONSE_DATA'
=> array(
93
'data_type'
=>
'text'
,
94
'required'
=>
true
,
95
),
96
);
97
}
98
99
public
static
function
onBeforeAdd
(
Entity
\
Event
$event)
100
{
101
$result =
new
Entity\EventResult();
102
$result->modifyFields(array(
"TIMESTAMP_X"
=>
new
DateTime
()));
103
return
$result;
104
}
105
106
public
static
function
clean
()
107
{
108
$connection =
Application::getConnection
();
109
$sqlHelper = $connection->getSqlHelper();
110
111
$tableName = static::getTableName();
112
$deleteBorder = $sqlHelper->addSecondsToDateTime(
113
-static::TTL,
114
$sqlHelper->getCurrentDateTimeFunction()
115
);
116
117
$connection->queryExecute(
"DELETE FROM {$tableName} WHERE TIMESTAMP_X < {$deleteBorder}"
);
118
119
return
__CLASS__.
"::clean();"
;
120
}
121
}
Bitrix\Main\Application
Definition
application.php:28
Bitrix\Main\Application\getConnection
static getConnection($name="")
Definition
application.php:611
Bitrix\Main\Event
Definition
event.php:5
Bitrix\Main\ORM\Entity
Definition
entity.php:26
Bitrix\Main\Type\DateTime
Definition
datetime.php:9
Bitrix\Main\Web\HttpClient
Definition
httpclient.php:24
Bitrix\Seo\Adv\LogTable
Definition
log.php:42
Bitrix\Seo\Adv\LogTable\getMap
static getMap()
Definition
log.php:60
Bitrix\Seo\Adv\LogTable\clean
static clean()
Definition
log.php:106
Bitrix\Seo\Adv\LogTable\TTL
const TTL
Definition
log.php:43
Bitrix\Seo\Adv\LogTable\onBeforeAdd
static onBeforeAdd(Entity\Event $event)
Definition
log.php:99
Bitrix\Seo\Adv\LogTable\getTableName
static getTableName()
Definition
log.php:50
Bitrix\Seo\Adv
Definition
auto.php:2
Bitrix\Seo\Engine
Definition
bitrix.php:9
modules
seo
lib
adv
log.php
Создано системой
1.10.0