IndexRebuild::runFinalActions

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. IndexRebuild
  4. runFinalActions
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/agent/duplicate/volatile/indexrebuild.php
  • Класс: Bitrix\Crm\Agent\Duplicate\Volatile\IndexRebuild
  • Вызов: IndexRebuild::runFinalActions
protected function runFinalActions()
{
	$actionsInfo = $this->getFinalActionsInfo();
	$typeInfo = Volatile\TypeInfo::getInstance();
	$userTypeMap  = is_array($actionsInfo['USER_TYPE_MAP']) ? $actionsInfo['USER_TYPE_MAP'] : [];
	foreach ($userTypeMap as $userId => $info)
	{
		$isVolatileTypesReady = true;
		if (is_array($info['notReadyVolatileTypes']))
		{
			foreach ($info['notReadyVolatileTypes'] as $volatileTypeName)
			{
				$volatileTypeId = DuplicateIndexType::resolveID($volatileTypeName);
				if ($volatileTypeId !== $this->getVolatileTypeId())
				{
					$typeSettings = $typeInfo->getById($volatileTypeId);
					if (
						isset($typeSettings['STATE_ID'])
						&& $typeSettings['STATE_ID'] !== Volatile\Type\State::STATE_READY
					)
					{
						$isVolatileTypesReady = false;
						break;
					}
				}
			}
		}
		if ($isVolatileTypesReady && $userId > 0 && is_array($info['types']))
		{
			$entityTypeName = CCrmOwnerType::ResolveName($this->getEntityTypeId());

			/** @var \Bitrix\Crm\Agent\Duplicate\Background\IndexRebuild $agentClassName */
			$agentClassName = Helper::getInstance()->getAgentClassName($entityTypeName, 'IndexRebuild');
			$agent = $agentClassName::getInstance($userId);
			if ($agent)
			{
				$agent->start($info['types'], $info['scope'] ?? '', ['IS_HALF_PERCENTAGE_MODE' => 'Y']);
			}
		}
	}
}

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