1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
log.php
См. документацию.
1<?php
2namespace Bitrix\Rest;
3
4use Bitrix\Main;
5use Bitrix\Main\Request;
6
38class LogTable extends Main\Entity\DataManager
39{
45 public static function getTableName()
46 {
47 return 'b_rest_log';
48 }
49
55 public static function getMap()
56 {
57 return array(
58 'ID' => array(
59 'data_type' => 'integer',
60 'primary' => true,
61 'autocomplete' => true,
62 ),
63 'TIMESTAMP_X' => array(
64 'data_type' => 'datetime',
65 ),
66 'CLIENT_ID' => array(
67 'data_type' => 'string',
68 ),
69 'PASSWORD_ID' => array(
70 'data_type' => 'integer',
71 ),
72 'SCOPE' => array(
73 'data_type' => 'string',
74 ),
75 'METHOD' => array(
76 'data_type' => 'string',
77 ),
78 'REQUEST_METHOD' => array(
79 'data_type' => 'string',
80 ),
81 'REQUEST_URI' => array(
82 'data_type' => 'string',
83 ),
84 'REQUEST_AUTH' => array(
85 'data_type' => 'text',
86 'serialized' => true,
87 ),
88 'REQUEST_DATA' => array(
89 'data_type' => 'text',
90 'serialized' => true,
91 ),
92 'RESPONSE_STATUS' => array(
93 'data_type' => 'string',
94 ),
95 'RESPONSE_DATA' => array(
96 'data_type' => 'text',
97 'serialized' => true,
98 ),
99 'EVENT_ID' => array(
100 'data_type' => 'integer',
101 ),
102 'MESSAGE' => array(
103 'data_type' => 'text',
104 ),
105 );
106 }
107
108 public static function getCountAll()
109 {
110 $entity = static::getEntity();
111 $sqlTableName = static::getTableName();
112
113 $sql = "SELECT count(1) CNT FROM {$sqlTableName}";
114 $query = $entity->getConnection()->query($sql);
115 return $query->fetch()["CNT"];
116 }
117
118 public static function clearAll()
119 {
120 $entity = static::getEntity();
121 $sqlTableName = static::getTableName();
122
123 $sql = "TRUNCATE TABLE {$sqlTableName}";
124 $entity->getConnection()->queryExecute($sql);
125 }
126
127 public static function cleanUpAgent()
128 {
129 $entity = static::getEntity();
130 $sqlTableName = static::getTableName();
131 $connection = $entity->getConnection();
132
133 $lastIdQuery = $connection->query("
134 SELECT max(ID) MID
135 from {$sqlTableName}
136 ");
137 $lastId = $lastIdQuery->fetch();
138 if ($lastId && $lastId['MID'])
139 {
140 $date = new Main\Type\DateTime();
141 $date->add("-7D");
142
143 $lastTimeQuery = $connection->query("
144 SELECT TIMESTAMP_X
145 from {$sqlTableName}
146 WHERE ID = $lastId[MID]
147 ");
148 $lastTime = $lastTimeQuery->fetch();
149 if ($lastTime && $lastTime['TIMESTAMP_X'] < $date)
150 {
151 static::clearAll();
152 }
153 }
154
155 return "\\Bitrix\\Rest\\LogTable::cleanUpAgent();";
156 }
157
158 public static function filterResponseData(&$data): void
159 {
160 //filter non-searizable objects
161 if (is_object($data) && !method_exists($data, '__serialize'))
162 {
163 $data = '';
164 }
165 else if (is_array($data))
166 {
167 foreach ($data as &$oneData)
168 {
169 static::filterResponseData($oneData);
170 }
171 }
172 }
173}
$connection
Определения actionsdefinitions.php:38
Определения log.php:39
static getMap()
Определения log.php:55
static getCountAll()
Определения log.php:108
static filterResponseData(&$data)
Определения log.php:158
static clearAll()
Определения log.php:118
static cleanUpAgent()
Определения log.php:127
static getTableName()
Определения log.php:45
if(!\Bitrix\Main\Loader::includeModule('clouds')) $lastId
Определения sync.php:68
$data['IS_AVAILABLE']
Определения .description.php:13
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$query
Определения get_search.php:11
$entity