Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/sale/lib/internals/ |
Upload File : |
<?php namespace Bitrix\Sale\Internals; use Bitrix\Main\Application; use Bitrix\Main\Entity\DataManager; use Bitrix\Main\Entity\ExpressionField; use Bitrix\Main\Type\DateTime; use Bitrix\Sale\Exchange\Internals\Logger; use Bitrix\Sale\Rest\Synchronization\LoggerDiag; /** * Class SynchronizerLogTable * * DO NOT WRITE ANYTHING BELOW THIS * * <<< ORMENTITYANNOTATION * @method static EO_SynchronizerLog_Query query() * @method static EO_SynchronizerLog_Result getByPrimary($primary, array $parameters = []) * @method static EO_SynchronizerLog_Result getById($id) * @method static EO_SynchronizerLog_Result getList(array $parameters = []) * @method static EO_SynchronizerLog_Entity getEntity() * @method static \Bitrix\Sale\Internals\EO_SynchronizerLog createObject($setDefaultValues = true) * @method static \Bitrix\Sale\Internals\EO_SynchronizerLog_Collection createCollection() * @method static \Bitrix\Sale\Internals\EO_SynchronizerLog wakeUpObject($row) * @method static \Bitrix\Sale\Internals\EO_SynchronizerLog_Collection wakeUpCollection($rows) */ class SynchronizerLogTable extends DataManager { public static function getTableName() { return 'b_sale_synchronizer_log'; } public static function getMap() { return array( 'ID' => array( 'data_type' => 'integer', 'primary' => true, 'autocomplete' => true ), 'MESSAGE_ID' => array( 'data_type' => 'text' ), 'MESSAGE' => array( 'data_type' => 'text' ), 'DATE_INSERT' => array( 'data_type' => 'datetime', 'require' => true, 'default_value' => function(){return new \Bitrix\Main\Type\DateTime();} ) ); } /** * Clears old logging data */ public static function deleteOldRecords(): void { $loggingRecord = SynchronizerLogTable::getList([ 'select' => [ new ExpressionField('MAX_DATE_INSERT', 'MAX(%s)', ['DATE_INSERT']) ], ])->fetch(); if ($loggingRecord) { if($loggingRecord['MAX_DATE_INSERT'] <> '') { $date = new DateTime($loggingRecord['MAX_DATE_INSERT']); $interval = LoggerDiag::getInterval(); $connection = Application::getConnection(); $helper = $connection->getSqlHelper(); $connection->queryExecute("delete from " . $helper->quote(static::getTableName()) . " where DATE_INSERT < " . $helper->addDaysToDateTime(-$interval, "'" . $date->format('Y-m-d') . "'") ); } } } }