• Модуль: clouds
  • Путь к файлу: ~/bitrix/modules/clouds/classes/general/storage_service_s3.php
  • Класс: CCloudStorageService_S3
  • Вызов: CCloudStorageService_S3::DeleteFile
function DeleteFile($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"],
		'DELETE',
		$arBucket["BUCKET"],
		$filePath
	);

	if (
		defined("BX_CLOUDS_COUNTERS_DEBUG")
		&& $this->status == 204
		&& !preg_match(BX_CLOUDS_COUNTERS_DEBUG, $filePath)
	)
	{
		CCloudsDebug::getInstance()->startAction($filePath);
	}

	if($this->status == 204)
	{
		$APPLICATION->ResetException();
		return true;
	}
	elseif($this->checkForTokenExpiration($this->status, $this->result))
	{
		$this->tokenHasExpired = true;
		return false;
	}
	else
	{
		$APPLICATION->ResetException();
		if (defined("BX_CLOUDS_ERROR_DEBUG"))
		{
			AddMessage2Log($this);
		}
		return false;
	}
}