• Модуль: iblock
  • Путь к файлу: ~/bitrix/modules/iblock/classes/general/iblockxmlimport.php
  • Класс: CIBlockXmlImport
  • Вызов: CIBlockXmlImport::importElementsAction
private function importElementsAction(): void
{
	$this->xmlImport->freezeIblockCache();
	$result = $this->xmlImport->GetTotalCountElementsForImport();
	if (!$result)
	{
		$this->addError(Loc::getMessage(
			'IBLOCK_XML_IMPORT_ERR_ELEMENTS_IMPORT_FAILURE',
			['#ERROR#' => $this->xmlImport->LAST_ERROR]
		));

		return;
	}
	$this->xmlImport->ReadCatalogData(
		$_SESSION[self::SESSION_STORAGE_ID]['SECTIONS_MAP'],
		$_SESSION[self::SESSION_STORAGE_ID]['PRICES_MAP']
	);
	$result = $this->xmlImport->ImportElements(
		$this->startTime,
		$this->getParameter('INTERVAL')
	);
	$result = $this->xmlImport->updateCounters($result);
	$this->xmlImport->unFreezeIblockCache();
	$this->xmlImport->clearIblockCacheOnHit();
	if ($result == 0)
	{
		$this->nextStep();
		$this->setMessage(Loc::getMessage('IBLOCK_XML_IMPORT_MESS_IBLOCK_ELEMENTS_IMPORT_COMPLETE'));
	}
	else
	{
		$this->setMessage(Loc::getMessage(
			'IBLOCK_XML_IMPORT_MESS_IBLOCK_ELEMENTS_IMPORT_PROGRESS',
			[
				'#TOTAL#' => $this->stepParameters['DONE']['ALL'],
				'#DONE#' => $this->stepParameters['DONE']['CRC']
			]
		));
		$this->setProgressCounter(
			$this->stepParameters['DONE']['ALL'],
			$this->stepParameters['DONE']['CRC']
		);
	}
}