• Модуль: translate
  • Путь к файлу: ~/bitrix/modules/translate/lib/io/archiver.php
  • Класс: BitrixTranslateIOArchiver
  • Вызов: Archiver::extract
public function extract(TranslateIODirectory $target)
{
	$unpack = Closure::bind(
		function($path)
		{
			if ($this instanceof CArchiver)
			{
				/** @noinspection */
				$this->_arErrors = array();

				$listDetail = array();

				if ($result = $this->_openRead())
				{
					$result = $this->_extractList($path, $listDetail, 'complete', array(), '');
					$this->_close();
				}
				if ($result)
				{
					return count($listDetail);
				}
			}
			return -1;
		},
		$this->archive,
		'CArchiver'
	);

	//$res = $this->archive->extractFiles($target->getPhysicalPath());
	$res = $unpack($target->getPhysicalPath());

	if ($res < 0)
	{
		$errors = $this->archive->getErrors();
		if (count($errors) > 0)
		{
			foreach ($errors as $errorMessage)
			{
				$this->addError(new MainError($errorMessage[1], $errorMessage[0]));
			}
		}
	}
	else
	{
		$this->processedFileCount = $res;
	}

	return ($this->hasErrors() !== true);
}