• Модуль: clouds
  • Путь к файлу: ~/bitrix/modules/clouds/classes/general/storage_service_s3.php
  • Класс: CCloudStorageService_S3
  • Вызов: CCloudStorageService_S3::CheckSettings
function CheckSettings($arBucket, &$arSettings)
{
	global $APPLICATION;
	$aMsg =/*.(array[int][string]string).*/array();

	$result = array(
		"HOST" => is_array($arSettings)? trim($arSettings["HOST"]): '',
		"ACCESS_KEY" => is_array($arSettings)? trim($arSettings["ACCESS_KEY"]): '',
		"SECRET_KEY" => is_array($arSettings)? trim($arSettings["SECRET_KEY"]): '',
		"USE_HTTPS" => is_array($arSettings) && $arSettings["USE_HTTPS"] == "Y"? "Y": "N",
	);

	if($arBucket["READ_ONLY"] !== "Y" && $result["HOST"] === '')
	{
		$aMsg[] = array(
			"id" => $this->GetID()."INP_HOST",
			"text" => GetMessage("CLO_STORAGE_S3_EMPTY_HOST"),
		);
	}

	if($arBucket["READ_ONLY"] !== "Y" && $result["ACCESS_KEY"] === '')
	{
		$aMsg[] = array(
			"id" => $this->GetID()."INP_ACCESS_KEY",
			"text" => GetMessage("CLO_STORAGE_S3_EMPTY_ACCESS_KEY"),
		);
	}

	if($arBucket["READ_ONLY"] !== "Y" && $result["SECRET_KEY"] === '')
	{
		$aMsg[] = array(
			"id" => $this->GetID()."INP_SECRET_KEY",
			"text" => GetMessage("CLO_STORAGE_S3_EMPTY_SECRET_KEY"),
		);
	}

	if(!empty($aMsg))
	{
		$e = new CAdminException($aMsg);
		$APPLICATION->ThrowException($e);
		return false;
	}
	else
	{
		$arSettings = $result;
	}

	return true;
}