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

	//Try to fix space in the path
	if ($this->status == 404 && mb_strpos($filePath, '+') !== false)
	{
		$filePath = str_replace('+', '%20', $filePath);
		$this->SendRequest(
			$arBucket["SETTINGS"],
			"DELETE",
			$arBucket["BUCKET"],
			$filePath
		);
	}

	if($this->status == 204 || $this->status == 404)
	{
		$APPLICATION->ResetException();
		return true;
	}
	else
	{
		$APPLICATION->ResetException();
		return false;
	}
}