%PDF- %PDF-
Server IP : 37.220.80.31 / Your IP : 3.15.218.169 Web Server : Apache/2.4.52 (Ubuntu) System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64 User : www-root ( 1010) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/sale/lib/exchange/logger/ |
Upload File : |
<?php namespace Bitrix\Sale\Exchange\Logger; use Bitrix\Main\ArgumentException; use Bitrix\Sale\Exchange\Internals\ExchangeLogTable; class Exchange { protected $providerType = null; /** * Exchange constructor. * @param $providerType * @throws ArgumentException */ public function __construct($providerType) { if($providerType == '') { throw new ArgumentException('Options providerType must be specified', 'providerType'); } $this->providerType = $providerType; } /** * @param array $params * @return \Bitrix\Main\ORM\Data\AddResult * @throws \Exception */ public function add(array $params) { $params['PROVIDER'] = $this->providerType; return ExchangeLogTable::add($params); } /** * @param $params * @return \Bitrix\Main\ORM\Query\Result * @throws \Bitrix\Main\ArgumentException * @throws \Bitrix\Main\ObjectPropertyException * @throws \Bitrix\Main\SystemException */ public function getList(array $params) { $params['filter'] = isset($params['filter']) ? $params['filter']:[]; $params['filter']['PROVIDER'] = $this->providerType; return ExchangeLogTable::getList($params); } /** * @param $timeUpdate * @param $entityTypeId * @param $direction * @return array * @throws ArgumentException * @throws \Bitrix\Main\ObjectPropertyException * @throws \Bitrix\Main\SystemException */ public function getEffectedRows($timeUpdate, $entityTypeId, $direction) { $result = array(); if($timeUpdate <> '') { $r = ExchangeLogTable::getList(array( 'select' => array( 'ENTITY_ID', 'ENTITY_DATE_UPDATE' ), 'filter' => array( 'ENTITY_TYPE_ID'=>$entityTypeId, '=ENTITY_DATE_UPDATE'=>$timeUpdate, '=DIRECTION'=>$direction, '=PROVIDER'=>$this->providerType, ), 'order'=>array('ID'=>'ASC'), )); while ($order = $r->fetch()) $result[$order['ENTITY_DATE_UPDATE']->toString()][]=$order['ENTITY_ID']; } return $result; } public function isEffected($list, array $logs) { $dateUpdate = $list["DATE_UPDATE"]->toString(); $result = (isset($logs[$dateUpdate]) && in_array($list['ID'], $logs[$dateUpdate])); return $result; } /** * Clears old logging data */ public function deleteOldRecords($direction, $interval) { ExchangeLogTable::deleteOldRecords($direction, $this->providerType, $interval); } }