• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/zip.php
  • Класс: CZip
  • Вызов: CZip::_getFileList
private function _getFileList(&$arFilesList)
{
	if (($this->zipfile = @fopen($this->io->GetPhysicalName($this->zipname), 'rb')) == 0)
	{
		$this->_errorLog("ERR_READ", str_replace("#FILE_NAME#", removeDocRoot($this->zipname), GetMessage("MAIN_ZIP_ERR_READ")));
		return $this->arErrors;
	}

	//get central directory information
	$arCentralDirInfo = [];
	if (($res = $this->_readEndCentralDir($arCentralDirInfo)) != 1)
	{
		return $res;
	}

	//go to the beginning of the central directory
	@rewind($this->zipfile);

	if (@fseek($this->zipfile, $arCentralDirInfo['offset']))
	{
		$this->_errorLog("ERR_INVALID_ARCHIVE_ZIP", GetMessage("MAIN_ZIP_ERR_INVALID_ARCHIVE_ZIP"));
		return $this->arErrors;
	}

	//read each entry
	for ($i = 0; $i < $arCentralDirInfo['entries']; $i++)
	{
		//read the file header
		if (($res = $this->_readCentralFileHeader($header)) != 1)
		{
			return $res;
		}
		$header['index'] = $i;

		//get only interesting attributes
		$this->_convertHeader2FileInfo($header, $arFilesList[$i]);
		unset($header);
	}

	$this->_closeFile();
	return $res;
}