• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/tradingplatform/vk/agent.php
  • Класс: Bitrix\Sale\TradingPlatform\Vk\Agent
  • Вызов: Agent::add
static function add($feedType, $exportId, $startPosition = "", $interval, $once = false)
{
	if ($interval <= 0)
		return 0;
	
	if (empty($exportId))
		throw new ArgumentNullException('exportId');
	
	$exportId = \EscapePHPString($exportId);
	
	$timeToStart = ConvertTimeStamp(strtotime(date('Y-m-d H:i:s', time() + $interval)), 'FULL');
	
	$result = \CAgent::AddAgent(
		self::createAgentNameForAdd($feedType, $exportId, $startPosition, $once),
		'sale',
		"N",
		$interval,
		$timeToStart,
		"Y",
		$timeToStart
	);
	
	if ($result)
	{
		$vk = Vk::getInstance();
		$vk->log(
			TradingPlatform\Logger::LOG_LEVEL_DEBUG,
			"VK_AGENT__NEW_AGENT",
			'FEED_' . $feedType,
			"New agent was crated for VKontakte export " . $feedType . ". Agent ID: " . $result . "."
		);
	}
	
	return $result;
}