SyncLogMessageSourceIdAgent::execute

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. SyncLogMessageSourceIdAgent
  4. execute
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/agent/timeline/synclogmessagesourceidagent.php
  • Класс: Bitrix\Crm\Agent\Timeline\SyncLogMessageSourceIdAgent
  • Вызов: SyncLogMessageSourceIdAgent::execute
public function execute(array &$option)
{
	if (!Loader::includeModule(self::$moduleId))
	{
		return false;
	}

	$option['steps'] = (int)($option['steps'] ?? 0);
	$lastId = ($option['lastId'] ?? 0);
	$processedCount = 0;

	$items = $this->getList($lastId);
	foreach ($items as $item)
	{
		$lastId = (int)$item['ID'];
		$option['steps']++;
		$processedCount++;

		if (empty($item['LOG_MESSAGE_SOURCE_ID']))
		{
			continue;
		}

		TimelineTable::update((int)$item['ID'], [
			'SOURCE_ID' => $item['LOG_MESSAGE_SOURCE_ID']
		]);
	}

	$option['lastId'] = $lastId;

	return ($processedCount < self::BATCH_LIMIT) ? self::FINISH_EXECUTION : self::CONTINUE_EXECUTION;
}

Добавить комментарий