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/yandex.market/lib/watcher/track/ |
Upload File : |
<?php namespace Yandex\Market\Watcher\Track; use Bitrix\Main; use Yandex\Market\Data\Type; use Yandex\Market\Glossary; use Yandex\Market\Export; use Yandex\Market\SalesBoost; use Yandex\Market\Watcher; use Yandex\Market\Reference\Agent; class EntityChange extends Agent\Base { public static function schedule($service, $entity, $id, Main\Type\Date $nextDate) { if ($nextDate instanceof Type\CanonicalDateTime) { $nextDate = clone $nextDate; $nextDate->setServerTimeZone(); } static::register([ 'method' => 'fire', 'arguments' => [ $service, $entity, (int)$id ], 'next_exec' => $nextDate->toString(), 'update' => Agent\Controller::UPDATE_RULE_STRICT, ]); } public static function release($service, $entity, $id) { static::unregister([ 'method' => 'fire', 'arguments' => [ $service, $entity, (int)$id ], ]); } public static function fire($service, $entity, $id) { global $pPERIOD; $isNeedRepeat = false; ElementChange::add($entity, $id, $id); $model = static::model($service, $entity, $id); if ($model === null) { return false; } $nextDate = $model->getNextActiveDate(); $model->updateListener(); if ($nextDate !== null) { $isNeedRepeat = true; $pPERIOD = $nextDate->getTimestamp() - time(); } return $isNeedRepeat; } /** @return Watcher\Agent\EntityWithActiveDates|null */ protected static function model($service, $type, $id) { try { $classMap = [ Glossary::SERVICE_EXPORT => [ Export\Glossary::ENTITY_PROMO => Export\Promo\Model::class, Export\Glossary::ENTITY_COLLECTION => Export\Collection\Model::class, ], Glossary::SERVICE_SALES_BOOST => [ Glossary::SERVICE_SALES_BOOST => SalesBoost\Setup\Model::class, ], ]; if (!isset($classMap[$service])) { throw new Main\ArgumentException(sprintf('unknown %s service', $service)); } if (!isset($classMap[$service][$type])) { throw new Main\ArgumentException(sprintf('unknown %s type for %s', $type, $service)); } $className = $classMap[$service][$type]; $result = $className::loadById($id); } catch (Main\ObjectNotFoundException $exception) { $result = null; } return $result; } }