• Модуль: seo
  • Путь к файлу: ~/bitrix/modules/seo/lib/Sitemap/Generator.php
  • Класс: BitrixSeoSitemapGenerator
  • Вызов: Generator::runIblockIndex
protected function runIblockIndex(): bool
{
	$result = true;

	$arIBlockList = [];
	if (Loader::includeModule('iblock'))
	{
		$arIBlockList = $this->sitemapData['SETTINGS']['IBLOCK_ACTIVE'];
		if (count($arIBlockList) > 0)
		{
			$arIBlocks = [];
			$dbIBlock = CIBlock::GetList([], ['ID' => array_keys($arIBlockList)]);
			while ($arIBlock = $dbIBlock->Fetch())
			{
				$arIBlocks[$arIBlock['ID']] = $arIBlock;
			}

			foreach ($arIBlockList as $iblockId => $iblockActive)
			{
				if ($iblockActive !== 'Y' || !array_key_exists($iblockId, $arIBlocks))
				{
					unset($arIBlockList[$iblockId]);
				}
				else
				{
					RuntimeTable::add([
						'PID' => $this->sitemapId,
						'PROCESSED' => RuntimeTable::UNPROCESSED,
						'ITEM_ID' => $iblockId,
						'ITEM_TYPE' => RuntimeTable::ITEM_TYPE_IBLOCK,
					]);
				}
			}
		}
	}

	$this->state['LEFT_MARGIN'] = 0;
	$this->state['IBLOCK_LASTMOD'] = 0;

	$this->state['IBLOCK'] = [];
	$this->state['IBLOCK_MAP'] = [];

	if (count($arIBlockList) <= 0)
	{
		$this->step = Step::STEPS[Step::STEP_IBLOCK];
		$this->statusMessage = Loc::getMessage('SITEMAP_RUN_IBLOCK_EMPTY');
	}
	else
	{
		$this->step = Step::STEPS[Step::STEP_IBLOCK_INDEX];
		$this->statusMessage = Loc::getMessage('SITEMAP_RUN_IBLOCK');
	}

	return $result;
}