BxDolStorageS3v4.php 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup UnaCore UNA Core
  7. * @{
  8. */
  9. /**
  10. * File storage in Amazon S3 with signature v4 authorisation.
  11. * @see BxDolStorage
  12. */
  13. class BxDolStorageS3v4 extends BxDolStorageS3
  14. {
  15. protected function init ($aObject)
  16. {
  17. require_once(BX_DIRECTORY_PATH_PLUGINS . 'unacms/amazon-s3-php-class-hmac-v2/S3.php');
  18. require_once(BX_DIRECTORY_PATH_PLUGINS . 'tpyo/amazon-s3-php-class/S3.php'); // HMAC v4
  19. $this->_s3 = new S3v4\S3(
  20. getParam('sys_storage_s3_access_key'),
  21. getParam('sys_storage_s3_secret_key'),
  22. $this->_bSSL,
  23. $this->_sEndpoint ? $this->_sEndpoint : 's3.amazonaws.com',
  24. getParam('sys_storage_s3_region')
  25. );
  26. if ($this->_bSSL && getParam('sys_curl_ssl_allow_untrusted'))
  27. $this->_s3->setSSL($this->_bSSL, false);
  28. $this->_s3->setExceptions(true);
  29. }
  30. }
  31. /** @} */