@@ -71,11 +71,17 @@ protected function parseParams($params) {
7171 $ this ->copySizeLimit = $ params ['copySizeLimit ' ] ?? 5242880000 ;
7272 $ this ->useMultipartCopy = (bool )($ params ['useMultipartCopy ' ] ?? true );
7373 $ params ['region ' ] = empty ($ params ['region ' ]) ? 'eu-west-1 ' : $ params ['region ' ];
74+ $ params ['s3-accelerate ' ] = $ params ['hostname ' ] == 's3-accelerate.amazonaws.com ' || $ params ['hostname ' ] == 's3-accelerate.dualstack.amazonaws.com ' ;
7475 $ params ['hostname ' ] = empty ($ params ['hostname ' ]) ? 's3. ' . $ params ['region ' ] . '.amazonaws.com ' : $ params ['hostname ' ];
7576 if (!isset ($ params ['port ' ]) || $ params ['port ' ] === '' ) {
7677 $ params ['port ' ] = (isset ($ params ['use_ssl ' ]) && $ params ['use_ssl ' ] === false ) ? 80 : 443 ;
7778 }
7879 $ params ['verify_bucket_exists ' ] = $ params ['verify_bucket_exists ' ] ?? true ;
80+
81+ if ($ params ['s3-accelerate ' ]) {
82+ $ params ['verify_bucket_exists ' ] = false ;
83+ }
84+
7985 $ this ->params = $ params ;
8086 }
8187
@@ -122,6 +128,13 @@ public function getConnection() {
122128 'http ' => ['verify ' => $ this ->getCertificateBundlePath ()],
123129 'use_aws_shared_config_files ' => false ,
124130 ];
131+
132+ if ($ this ->params ['s3-accelerate ' ]) {
133+ $ options ['use_accelerate_endpoint ' ] = true ;
134+ } else {
135+ $ options ['endpoint ' ] = $ base_url ;
136+ }
137+
125138 if ($ this ->getProxy ()) {
126139 $ options ['http ' ]['proxy ' ] = $ this ->getProxy ();
127140 }
@@ -150,7 +163,9 @@ public function getConnection() {
150163 'exception ' => $ e ,
151164 'app ' => 'objectstore ' ,
152165 ]);
153- throw new \Exception ('Creation of bucket " ' . $ this ->bucket . '" failed. ' . $ e ->getMessage ());
166+ if ($ e ->getAwsErrorCode () !== "BucketAlreadyOwnedByYou " ) {
167+ throw new \Exception ('Creation of bucket " ' . $ this ->bucket . '" failed. ' . $ e ->getMessage ());
168+ }
154169 }
155170 }
156171
0 commit comments