• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/backup.php
  • Класс: CTar
  • Вызов: CTar::open
function open($file, $mode='r')
{
	$this->file = $file;
	$this->mode = $mode;

	if (is_dir($file))
		return $this->Error('File is directory: '.$file);

	if ($this->EncryptKey && !function_exists('openssl_encrypt'))
		return $this->Error('Function openssl_encrypt is not available');

	if ($mode == 'r' && !file_exists($file))
		return $this->Error('File does not exist: '.$file);

	if ($this->gzip)
	{
		if(!function_exists('gzopen'))
		{
			return $this->Error('Function "gzopen" is not available');
		}
		else
		{
			if ($mode == 'a' && !file_exists($file) && !$this->createEmptyGzipExtra($file))
			{
				return false;
			}
			$this->res = gzopen($file,$mode."b");
		}
	}
	else
	{
		$this->res = fopen($file,$mode."b");
	}

	return $this->res;
}