• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/tar_gz.php
  • Класс: CArchiver
  • Вызов: CArchiver::Add
public function Add($vFileList, $strAddPath = false, $strRemovePath = false)
{
	$this->_arErrors = [];

	$bNewArchive = true;
	if (file_exists($this->io->GetPhysicalName($this->_strArchiveName))
		&& is_file($this->io->GetPhysicalName($this->_strArchiveName)))
	{
		$bNewArchive = false;
	}

	if ($bNewArchive)
	{
		if (!$this->_openWrite())
		{
			return false;
		}
	}
	else
	{
		if (!$this->_openAppend())
		{
			return false;
		}
	}
	$res = false;
	$arFileList = $this->_parseFileParams($vFileList);

	if (is_array($arFileList) && !empty($arFileList))
	{
		$res = $this->_addFileList($arFileList, $strAddPath, $strRemovePath);
	}

	if ($res)
	{
		$this->_writeFooter();
	}

	$this->_close();

	if ($bNewArchive && !$res)
	{
		$this->_cleanFile();
	}

	return $res;
}