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/php_interface/wbs24.lib/lib/Kit/ |
Upload File : |
<?php namespace Wbs24\Lib\Kit; use Bitrix\Main\Loader; class Agents { const TIME_LIMIT = 30; protected $wrappers; public function __construct($objects = []) { $this->wrappers = new \stdClass(); $this->wrappers->CAgent = $objects['CAgent'] ?? new \CAgent(); } public static function restartUpdateKitPricesAgent() { self::updateKitPricesAgent(); return "\\".__CLASS__."::".__FUNCTION__."();"; } public static function updateKitPricesAgent($fromId = 0, $helper = false, $agents = false) { if (!$helper) $helper = new Helper(); if (!$agents) $agents = new Agents(); $time = time(); $lastId = 0; $ownerIds = $helper->getKitOwnerIds(false, $fromId); foreach ($ownerIds as $ownerId) { $helper->updateKitPrice($ownerId); if ($time + self::TIME_LIMIT < time()) { $agentName = '\\'.__CLASS__.'::'.__FUNCTION__.'('.$ownerId.');'; $agents->createAgent($agentName); break; } } return ''; } public function createAgent($agentName) { $this->wrappers->CAgent->AddAgent( $agentName, "", "N", 60 ); } }