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

	if($arBucket["PREFIX"] != "")
	{
		//Do not delete bucket if there is some files left
		if(!$this->IsEmptyBucket($arBucket))
			return false;

		//Let's pretend we deleted the bucket
		return true;
	}

	$this->SetLocation($arBucket["LOCATION"]);
	$response = $this->SendRequest(
		$arBucket["SETTINGS"],
		'DELETE',
		$arBucket["BUCKET"]
	);

	if(
		$this->status == 204/*No content*/
		|| $this->status == 404/*Not exists*/
		|| $this->status == 403/*Access denied*/
	)
	{
		$APPLICATION->ResetException();
		return true;
	}
	elseif (is_array($response))
	{
		return true;
	}
	else
	{
		if (defined("BX_CLOUDS_ERROR_DEBUG"))
		{
			AddMessage2Log($this);
		}
		return false;
	}
}