• Модуль: clouds
  • Путь к файлу: ~/bitrix/modules/clouds/classes/general/storage_service_s3.php
  • Класс: CCloudStorageService_S3
  • Вызов: CCloudStorageService_S3::GetFileInfo
public function GetFileInfo($arBucket, $filePath)
{
	global $APPLICATION;

	if($arBucket["PREFIX"] != "")
	{
		if(mb_substr($filePath, 0, mb_strlen($arBucket["PREFIX"]) + 2) != "/".$arBucket["PREFIX"]."/")
			$filePath = "/".$arBucket["PREFIX"]."/".ltrim($filePath, "/");
	}
	$filePath = CCloudUtil::URLEncode($filePath, "UTF-8", true);

	$this->SetLocation($arBucket["LOCATION"]);
	$this->SendRequest(
		$arBucket["SETTINGS"],
		'HEAD',
		$arBucket["BUCKET"],
		$filePath
	);

	if($this->status == 200)
	{
		$result = [];
		foreach ($this->headers as $name => $value)
		{
			$name = strtolower($name);
			if ($name === 'content-length')
			{
				$result['size'] = $value;
			}
			elseif ($name === 'etag')
			{
				$result['hash'] = trim($value, '"');
			}
			elseif ($name === 'last-modified')
			{
				$ts = strtotime($value);
				$result['mtime'] = mb_substr(gmdate('c', $ts), 0, 19);
			}
		}

		return count($result) == 3 ? $result : null;
	}
	elseif($this->checkForTokenExpiration($this->status, $this->result))
	{
		$this->tokenHasExpired = true;
		return false;
	}
	else
	{
		$APPLICATION->ResetException();
		return false;
	}
}