• Модуль: clouds
  • Путь к файлу: ~/bitrix/modules/clouds/classes/general/storage_bucket.php
  • Класс: CCloudStorageBucket
  • Вызов: CCloudStorageBucket::GetFileInfo
function GetFileInfo($filePath)
{
	$DIR_NAME = mb_substr($filePath, 0, mb_strrpos($filePath, "/") + 1);
	$FILE_NAME = mb_substr($filePath, mb_strlen($DIR_NAME));

	$arFileInfo = $this->service->GetFileInfo($this->arBucket, $filePath);
	if ($arFileInfo === false && $this->RenewToken())
	{
		$arFileInfo = $this->service->GetFileInfo($this->getBucketArray(), $filePath);
	}

	if ($arFileInfo === null)
	{
		$arListing = $this->service->ListFiles($this->arBucket, $DIR_NAME, false);
		if(is_array($arListing))
		{
			foreach($arListing["file"] as $i => $name)
			{
				if($name === $FILE_NAME)
				{
					return array(
						"name" => $name,
						"size" => $arListing["file_size"][$i],
						"mtime" => $arListing["file_mtime"][$i],
						"hash" => $arListing["file_hash"][$i],
					);
				}
			}
		}
	}
	elseif ($arFileInfo)
	{
		$arFileInfo['name'] = $FILE_NAME;
		return $arFileInfo;
	}
	return false;
}