1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
exchangelog.php
См. документацию.
1<?php
2
4
7
24class ExchangeLogTable extends Main\Entity\DataManager
25{
26 public static function getTableName()
27 {
28 return 'b_sale_exchange_log';
29 }
30
31 public static function getMap()
32 {
33 return array(
34 'ID' => array(
35 'data_type' => 'integer',
36 'primary' => true,
37 'autocomplete' => true
38 ),
39 'ENTITY_ID' => array(
40 'required' => true,
41 'data_type' => 'integer'
42 ),
43 'ENTITY_TYPE_ID' => array(
44 'required' => true,
45 'data_type' => 'integer'
46 ),
47 'PARENT_ID' => array(
48 'data_type' => 'integer'
49 ),
50 'OWNER_ENTITY_ID' => array(
51 'data_type' => 'integer'
52 ),
53 'ENTITY_DATE_UPDATE' => array(
54 'data_type' => 'datetime',
55 ),
56 'XML_ID' => array(
57 'data_type' => 'string'
58 ),
59 'MARKED' => array(
60 'data_type' => 'boolean',
61 'values' => array('N', 'Y')
62 ),
63 'DESCRIPTION' => array(
64 'data_type' => 'text'
65 ),
66 'MESSAGE' => array(
67 'data_type' => 'text'
68 ),
69 'DATE_INSERT' => array(
70 'data_type' => 'datetime',
71 'require' => true,
72 'default_value' => function(){return new \Bitrix\Main\Type\DateTime();}
73 ),
74 'DIRECTION' => array(
75 'data_type' => 'string',
76 'require' => true,
77 'values' => array('E', 'I')
78 ),
79 'PROVIDER' => array(
80 'data_type' => 'string'
81 ),
82 );
83 }
84
88 public static function deleteAll(): void
89 {
91 $helper = $connection->getSqlHelper();
92 $connection->queryExecute('DELETE FROM ' . $helper->quote(static::getTableName()));
93 }
94
98 public static function deleteOldRecords($direction, $provider, $interval): void
99 {
100 $direction = (string)$direction;
101 $provider = (string)$provider;
102 $interval = (int)$interval;
103 if ($direction === '')
104 {
105 throw new Main\ArgumentOutOfRangeException('$direction');
106 }
107 if ($provider === '')
108 {
109 throw new Main\ArgumentOutOfRangeException('$provider');
110 }
111
112 $loggingRecord = ExchangeLogTable::getList([
113 'select' => [
114 new Main\Entity\ExpressionField('MAX_DATE_INSERT', 'MAX(%s)', ['DATE_INSERT'])
115 ],
116 'filter' => [
117 '=DIRECTION' => $direction,
118 '=PROVIDER' => $provider,
119 ],
120 ])->fetch();
121
122 if ($loggingRecord)
123 {
124 if ($loggingRecord['MAX_DATE_INSERT'] <> '')
125 {
126 $date = new Main\Type\DateTime($loggingRecord['MAX_DATE_INSERT']);
128 $helper = $connection->getSqlHelper();
129 $connection->queryExecute("delete from " . $helper->quote(static::getTableName())
130 . " where"
131 . " DATE_INSERT < " . $helper->addDaysToDateTime(-$interval, "'" . $date->format('Y-m-d') . "'")
132 . " and DIRECTION = '" . $helper->forSql($direction) . "'"
133 . " and PROVIDER = '" . $helper->forSql($provider) . "'"
134 );
135 }
136 }
137 }
138}
$connection
Определения actionsdefinitions.php:38
if(!Loader::includeModule('messageservice')) $provider
Определения callback_ednaruimhpx.php:21
static getConnection($name="")
Определения application.php:638
static deleteOldRecords($direction, $provider, $interval)
Определения exchangelog.php:98
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
Определения ufield.php:9
$direction
Определения prolog_auth_admin.php:25