• Модуль: landing
  • Путь к файлу: ~/bitrix/modules/landing/lib/update/domain/check.php
  • Класс: BitrixLandingUpdateDomainCheck
  • Вызов: Check::execute
public function execute(array &$result)
{
	$lastId = Option::get('landing', 'update_domain_check', 0);
	$result['count'] = 0;
	if (!isset($result['steps']))
	{
		$result['steps'] = 0;
	}
	$forUpdate = [];

	// gets all domains by condition
	$resDomain = BitrixLandingDomain::getList([
		'select' => [
			'ID', 'DOMAIN'
		],
		'order' => [
			'ID' => 'asc'
		]
	]);
	while ($domain = $resDomain->fetch())
	{
		$resSite = BitrixLandingSite::getList([
			'select' => [
				'ID'
			],
			'filter' => [
				'DOMAIN_ID' => $domain['ID'],
				'CHECK_PERMISSIONS' => 'N'
			]
 			]);
		if (!$resSite->fetch())
		{
			$result['count']++;
			if ($domain['ID'] > $lastId)
			{
				if (count($forUpdate) < self::STEPPER_COUNT)
				{
					$forUpdate[$domain['ID']] = $domain['DOMAIN'];
				}
			}
		}
	}

	if (!empty($forUpdate))
	{
		$class = BitrixLandingManager::getExternalSiteController();
		foreach ($forUpdate as $id => $domain)
		{
			$lastId = $id;
			$result['steps']++;
			BitrixLandingDomain::delete($id);
			$class::deleteDomain($domain);
		}
		Option::set('landing', 'update_domain_check', $lastId);
		return true;
	}
	else
	{
		Option::delete('landing', array('name' => 'update_domain_check'));
		return false;
	}
}