• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/zip.php
  • Класс: CZip
  • Вызов: CZip::_checkDir
private function _checkDir($dir, $isDir = false)
{
	$res = 1;

	//remove '/' at the end
	if (($isDir) && (mb_substr($dir, -1) == '/'))
	{
		$dir = mb_substr($dir, 0, mb_strlen($dir) - 1);
	}

	//check if dir is available
	if ((is_dir($dir)) || ($dir == ""))
	{
		return 1;
	}

	//get parent directory
	$parentDir = dirname($dir);

	if ($parentDir != $dir)
	{
		//find the parent dir
		if ($parentDir != "")
		{
			if (($res = $this->_checkDir($parentDir)) != 1)
			{
				return $res;
			}
		}
	}

	//creating a directory
	if (!@mkdir($dir))
	{
		$this->_errorLog("ERR_DIR_CREATE_FAIL", str_replace("#DIR_NAME#", $dir, GetMessage("MAIN_ZIP_ERR_DIR_CREATE_FAIL")));
		return $this->arErrors;
	}

	return $res;
}