1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
synchronizerlog.php
См. документацию.
1<?php
2
3namespace Bitrix\Sale\Internals;
4
5use Bitrix\Main\Application;
6use Bitrix\Main\Entity\DataManager;
7use Bitrix\Main\Entity\ExpressionField;
8use Bitrix\Main\Type\DateTime;
9use Bitrix\Sale\Exchange\Internals\Logger;
10use Bitrix\Sale\Rest\Synchronization\LoggerDiag;
11
29{
30 public static function getTableName()
31 {
32 return 'b_sale_synchronizer_log';
33 }
34
35 public static function getMap()
36 {
37 return array(
38 'ID' => array(
39 'data_type' => 'integer',
40 'primary' => true,
41 'autocomplete' => true
42 ),
43 'MESSAGE_ID' => array(
44 'data_type' => 'text'
45 ),
46 'MESSAGE' => array(
47 'data_type' => 'text'
48 ),
49 'DATE_INSERT' => array(
50 'data_type' => 'datetime',
51 'require' => true,
52 'default_value' => function(){return new \Bitrix\Main\Type\DateTime();}
53 )
54 );
55 }
56
60 public static function deleteOldRecords(): void
61 {
62 $loggingRecord = SynchronizerLogTable::getList([
63 'select' => [
64 new ExpressionField('MAX_DATE_INSERT', 'MAX(%s)', ['DATE_INSERT'])
65 ],
66 ])->fetch();
67
68 if ($loggingRecord)
69 {
70 if($loggingRecord['MAX_DATE_INSERT'] <> '')
71 {
72 $date = new DateTime($loggingRecord['MAX_DATE_INSERT']);
73 $interval = LoggerDiag::getInterval();
74 $connection = Application::getConnection();
75 $helper = $connection->getSqlHelper();
76 $connection->queryExecute("delete from " . $helper->quote(static::getTableName())
77 . " where DATE_INSERT < " . $helper->addDaysToDateTime(-$interval, "'" . $date->format('Y-m-d') . "'")
78 );
79 }
80 }
81 }
82}
$connection
Определения actionsdefinitions.php:38
static getList(array $parameters=array())
Определения datamanager.php:431
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804