• Модуль: sender
  • Путь к файлу: ~/bitrix/modules/sender/lib/posting/segmentdatabuilder.php
  • Класс: BitrixSenderPostingSegmentDataBuilder
  • Вызов: SegmentDataBuilder::run
static function run($groupStateId, $perPage = null)
{
	$groupState = GroupStateTable::getById($groupStateId)->fetch();

	if (!$groupState['FILTER_ID'])
	{
		GroupStateTable::update(
			$groupStateId,
			[
				'STATE' => GroupStateTable::STATES['COMPLETED'],
			]
		);

		if ($groupState['GROUP_ID'])
		{
			self::checkIsSegmentPrepared($groupState['GROUP_ID']);
		}
		
		return '';
	}
	$segmentBuilder = new SegmentDataBuilder(
		(int)$groupState['GROUP_ID'],
		$groupState['FILTER_ID'],
		json_decode($groupState['ENDPOINT'], true),
		$groupState['ID']
	);

	if (!$segmentBuilder->buildData($perPage))
	{
		return SegmentDataBuilderJob::getAgentName($groupStateId);
	}

	return '';
}