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/catalog/run/steps/ |
Upload File : |
<?php namespace Yandex\Market\Catalog\Run\Steps; use Yandex\Market\Catalog\Run\Storage; use Yandex\Market\Data; use Yandex\Market\Catalog; use Yandex\Market\Result; class Downloader extends Data\Run\StepSkeleton { protected $processor; public function __construct(Catalog\Run\Processor $processor) { $this->processor = $processor; } public function getName() { return 'downloader'; } public function run($action, $offset = null) { $result = new Result\Step(); $offsetObject = new Data\Run\Offset($offset); (new Data\Run\Waterfall()) ->add(new Transport\HttpCatcher($this->getName(), $this->processor->makeLogger())) ->add([$this, 'iterateSteps']) ->run($action, $offsetObject); if ($offsetObject->interrupted()) { $result->setOffset((string)$offsetObject); $result->setTotal(1); if ($this->processor->getParameter('progressCount') === true) { $result->setReadyCount($this->readyCount()); } } return $result; } public function iterateSteps(Data\Run\Waterfall $waterfall, $action, Data\Run\Offset $offset) { foreach ($this->steps($action) as $step) { if (!$offset->tick('step')) { continue; } $step->run($offset); if ($offset->interrupted()) { break; } } $waterfall->next(); } private function steps($action) { if ($action === Catalog\Run\Processor::ACTION_FULL) { return [ new Downloader\PublishedReloader($this->processor), new Downloader\UnknownActualizer($this->processor), ]; } return [ new Downloader\UnknownActualizer($this->processor), ]; } private function readyCount() { return Storage\AssortmentTable::getCount([ '=CATALOG_ID' => $this->processor->getSetup()->getId(), '>=TIMESTAMP_X' => $this->processor->getParameter('initTime'), '!=STATUS' => Storage\AssortmentTable::STATUS_UNKNOWN, ]); } }