Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
synchronizerlog.php
1
<?php
2
3
4
namespace
Bitrix\Sale\Internals
;
5
6
7
use
Bitrix\Main\Application
;
8
use Bitrix\Main\Entity\DataManager;
9
use Bitrix\Main\Entity\ExpressionField;
10
use
Bitrix\Main\Type\DateTime
;
11
use
Bitrix\Sale\Exchange\Internals\Logger
;
12
use
Bitrix\Sale\Rest\Synchronization\LoggerDiag
;
13
30
class
SynchronizerLogTable
extends
DataManager
31
{
32
public
static
function
getTableName
()
33
{
34
return
'b_sale_synchronizer_log'
;
35
}
36
37
public
static
function
getMap
()
38
{
39
return
array(
40
'ID'
=> array(
41
'data_type'
=>
'integer'
,
42
'primary'
=>
true
,
43
'autocomplete'
=>
true
44
),
45
'MESSAGE_ID'
=> array(
46
'data_type'
=>
'text'
47
),
48
'MESSAGE'
=> array(
49
'data_type'
=>
'text'
50
),
51
'DATE_INSERT'
=> array(
52
'data_type'
=>
'datetime'
,
53
'require'
=>
true
,
54
'default_value'
=>
function
(){
return
new \Bitrix\Main\Type\DateTime();}
55
)
56
);
57
}
58
62
public
static
function
deleteOldRecords
($direction)
63
{
64
$tableName = static::getTableName();
65
66
$r =
SynchronizerLogTable::getList
(array(
67
'select'
=> array(
68
new
ExpressionField
(
'MAX_DATE_INSERT'
,
'MAX(%s)'
, array(
'DATE_INSERT'
))
69
)
70
));
71
72
if
($loggingRecord = $r->fetch())
73
{
74
if
($loggingRecord[
'MAX_DATE_INSERT'
] <>
''
)
75
{
76
$maxDateInsert = $loggingRecord[
'MAX_DATE_INSERT'
];
77
$date =
new
DateTime
($maxDateInsert);
78
$interval = LoggerDiag::getInterval();
79
$connection =
Application::getConnection
();
80
$connection->queryExecute(
"delete from {$tableName} where DATE_INSERT < DATE_SUB('{$date->format("
Y-m-d
")}', INTERVAL {$interval} DAY)"
);
81
}
82
}
83
}
84
}
Bitrix\Main\Application
Definition
application.php:28
Bitrix\Main\Application\getConnection
static getConnection($name="")
Definition
application.php:611
Bitrix\Main\ORM\Data\DataManager
Definition
datamanager.php:33
Bitrix\Main\ORM\Data\DataManager\getList
static getList(array $parameters=array())
Definition
datamanager.php:441
Bitrix\Main\ORM\Fields\ExpressionField
Definition
expressionfield.php:25
Bitrix\Main\Type\DateTime
Definition
datetime.php:9
Bitrix\Sale\Exchange\Internals\Logger
Definition
logger.php:13
Bitrix\Sale\Internals\SynchronizerLogTable
Definition
synchronizerlog.php:31
Bitrix\Sale\Internals\SynchronizerLogTable\getMap
static getMap()
Definition
synchronizerlog.php:37
Bitrix\Sale\Internals\SynchronizerLogTable\deleteOldRecords
static deleteOldRecords($direction)
Definition
synchronizerlog.php:62
Bitrix\Sale\Internals\SynchronizerLogTable\getTableName
static getTableName()
Definition
synchronizerlog.php:32
Bitrix\Sale\Rest\Synchronization\LoggerDiag
Definition
loggerdiag.php:12
Bitrix\Sale\Internals
Definition
accountnumber.php:3
modules
sale
lib
internals
synchronizerlog.php
Создано системой
1.10.0