• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/controller_member.php
  • Класс: CControllerTools
  • Вызов: CControllerTools::UnpackFileArchive
static function UnpackFileArchive($strfile, $path_to)
{
	global $APPLICATION;
	$res = true;

	$arcname = CTempFile::GetFileName(BitrixMainSecurityRandom::getString(32).'.tar.gz');
	CheckDirPath($arcname);

	if(file_put_contents($arcname, $strfile) !== false)
	{
		include_once(__DIR__ . '/tar_gz.php');
		$ob = new CArchiver($arcname);

		CheckDirPath($_SERVER['DOCUMENT_ROOT'].$path_to);
		$res = $ob->extractFiles($_SERVER['DOCUMENT_ROOT'].$path_to);

		if(!$res && is_object($APPLICATION))
		{
			$arErrors = $ob->GetErrors();
			if(!empty($arErrors))
			{
				$strError = "";
				foreach($arErrors as $error)
					$strError .= $error[1]."
"; $e = new CApplicationException($strError); $APPLICATION->ThrowException($e); } } } return $res; }