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/cvetdv.ru/bitrix/modules/yandex.market/lib/watcher/track/ |
Upload File : |
<?php namespace Yandex\Market\Watcher\Track; use Yandex\Market\Glossary; use Yandex\Market\Watcher\Agent; class Installer { private $track; private $bind; private $serviceType; private $ownerType; private $ownerId; public function __construct($serviceType, $ownerType, $ownerId) { $this->serviceType = $serviceType; $this->ownerType = $ownerType; $this->ownerId = $ownerId; $this->track = new SourceInstaller($serviceType, $ownerType, $ownerId); $this->bind = new BindInstaller($serviceType, $ownerType, $ownerId); } public function install(array $sources, array $entities) { if (empty($entities) && (empty($sources) || $this->isRootEntity())) { $this->uninstall(); return; } $this->track->install($sources); $this->bind->install($entities); $this->installState(); } public function uninstall() { $this->track->uninstall(); $this->bind->uninstall(); $this->dropAgent(); $this->dropState(); } private function isRootEntity() { return ($this->ownerType === Glossary::ENTITY_SETUP); } private function dropAgent() { if (!$this->isRootEntity()) { return; } Agent\StateFacade::drop('change', $this->serviceType, $this->ownerId); } private function installState() { if (!$this->isRootEntity()) { return; } $state = new StampState($this->serviceType, $this->ownerId); $state->start(); } private function dropState() { if (!$this->isRootEntity()) { return; } $state = new StampState($this->serviceType, $this->ownerId); $state->drop(); } }