Completed
Push — master ( c81d40...9b2e31 )
by Daniel
28:52
created
lib/private/Files/ObjectStore/S3ConnectionTrait.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 			throw new \Exception('Bucket has to be configured.');
34 34
 		}
35 35
 
36
-		$this->id = 'amazon::' . $params['bucket'];
36
+		$this->id = 'amazon::'.$params['bucket'];
37 37
 
38 38
 		$this->test = isset($params['test']);
39 39
 		$this->bucket = $params['bucket'];
@@ -46,10 +46,10 @@  discard block
 block discarded – undo
46 46
 		$this->uploadPartSize = $params['uploadPartSize'] ?? 524288000;
47 47
 		$this->putSizeLimit = $params['putSizeLimit'] ?? 104857600;
48 48
 		$this->copySizeLimit = $params['copySizeLimit'] ?? 5242880000;
49
-		$this->useMultipartCopy = (bool)($params['useMultipartCopy'] ?? true);
49
+		$this->useMultipartCopy = (bool) ($params['useMultipartCopy'] ?? true);
50 50
 		$this->retriesMaxAttempts = $params['retriesMaxAttempts'] ?? 5;
51 51
 		$params['region'] = empty($params['region']) ? 'eu-west-1' : $params['region'];
52
-		$params['hostname'] = empty($params['hostname']) ? 's3.' . $params['region'] . '.amazonaws.com' : $params['hostname'];
52
+		$params['hostname'] = empty($params['hostname']) ? 's3.'.$params['region'].'.amazonaws.com' : $params['hostname'];
53 53
 		$params['s3-accelerate'] = $params['hostname'] === 's3-accelerate.amazonaws.com' || $params['hostname'] === 's3-accelerate.dualstack.amazonaws.com';
54 54
 		if (!isset($params['port']) || $params['port'] === '') {
55 55
 			$params['port'] = (isset($params['use_ssl']) && $params['use_ssl'] === false) ? 80 : 443;
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 		}
84 84
 
85 85
 		$scheme = (isset($this->params['use_ssl']) && $this->params['use_ssl'] === false) ? 'http' : 'https';
86
-		$base_url = $scheme . '://' . $this->params['hostname'] . ':' . $this->params['port'] . '/';
86
+		$base_url = $scheme.'://'.$this->params['hostname'].':'.$this->params['port'].'/';
87 87
 
88 88
 		// Adding explicit credential provider to the beginning chain.
89 89
 		// Including default credential provider (skipping AWS shared config files).
@@ -139,15 +139,15 @@  discard block
 block discarded – undo
139 139
 		try {
140 140
 			$logger = Server::get(LoggerInterface::class);
141 141
 			if (!$this->connection::isBucketDnsCompatible($this->bucket)) {
142
-				$logger->debug('Bucket "' . $this->bucket . '" This bucket name is not dns compatible, it may contain invalid characters.',
142
+				$logger->debug('Bucket "'.$this->bucket.'" This bucket name is not dns compatible, it may contain invalid characters.',
143 143
 					['app' => 'objectstore']);
144 144
 			}
145 145
 
146 146
 			if ($this->params['verify_bucket_exists'] && !$this->connection->doesBucketExist($this->bucket)) {
147 147
 				try {
148
-					$logger->info('Bucket "' . $this->bucket . '" does not exist - creating it.', ['app' => 'objectstore']);
148
+					$logger->info('Bucket "'.$this->bucket.'" does not exist - creating it.', ['app' => 'objectstore']);
149 149
 					if (!$this->connection::isBucketDnsCompatible($this->bucket)) {
150
-						throw new StorageNotAvailableException('The bucket will not be created because the name is not dns compatible, please correct it: ' . $this->bucket);
150
+						throw new StorageNotAvailableException('The bucket will not be created because the name is not dns compatible, please correct it: '.$this->bucket);
151 151
 					}
152 152
 					$this->connection->createBucket(['Bucket' => $this->bucket]);
153 153
 					$this->testTimeout();
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 						'app' => 'objectstore',
158 158
 					]);
159 159
 					if ($e->getAwsErrorCode() !== 'BucketAlreadyOwnedByYou') {
160
-						throw new StorageNotAvailableException('Creation of bucket "' . $this->bucket . '" failed. ' . $e->getMessage());
160
+						throw new StorageNotAvailableException('Creation of bucket "'.$this->bucket.'" failed. '.$e->getMessage());
161 161
 					}
162 162
 				}
163 163
 			}
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 				$this->connection->getHandlerList()->remove('s3.auto_encode');
168 168
 			}
169 169
 		} catch (S3Exception $e) {
170
-			throw new StorageNotAvailableException('S3 service is unable to handle request: ' . $e->getMessage());
170
+			throw new StorageNotAvailableException('S3 service is unable to handle request: '.$e->getMessage());
171 171
 		}
172 172
 
173 173
 		return $this->connection;
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 	 * This function creates a credential provider based on user parameter file
197 197
 	 */
198 198
 	protected function paramCredentialProvider(): callable {
199
-		return function () {
199
+		return function() {
200 200
 			$key = empty($this->params['key']) ? null : $this->params['key'];
201 201
 			$secret = empty($this->params['secret']) ? null : $this->params['secret'];
202 202
 			$sessionToken = empty($this->params['session_token']) ? null : $this->params['session_token'];
@@ -214,14 +214,14 @@  discard block
 block discarded – undo
214 214
 	}
215 215
 
216 216
 	protected function getCertificateBundlePath(): ?string {
217
-		if ((int)($this->params['use_nextcloud_bundle'] ?? '0')) {
217
+		if ((int) ($this->params['use_nextcloud_bundle'] ?? '0')) {
218 218
 			// since we store the certificate bundles on the primary storage, we can't get the bundle while setting up the primary storage
219 219
 			if (!isset($this->params['primary_storage'])) {
220 220
 				/** @var ICertificateManager $certManager */
221 221
 				$certManager = Server::get(ICertificateManager::class);
222 222
 				return $certManager->getAbsoluteBundlePath();
223 223
 			} else {
224
-				return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt';
224
+				return \OC::$SERVERROOT.'/resources/config/ca-bundle.crt';
225 225
 			}
226 226
 		} else {
227 227
 			return null;
Please login to merge, or discard this patch.
lib/private/Files/ObjectStore/S3ConfigTrait.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,18 +24,18 @@
 block discarded – undo
24 24
 
25 25
 	protected int $timeout;
26 26
 
27
-	protected string|false $proxy;
27
+	protected string | false $proxy;
28 28
 
29 29
 	protected string $storageClass;
30 30
 
31 31
 	/** @var int Part size in bytes (float is added for 32bit support) */
32
-	protected int|float $uploadPartSize;
32
+	protected int | float $uploadPartSize;
33 33
 
34 34
 	/** @var int Limit on PUT in bytes (float is added for 32bit support) */
35
-	private int|float $putSizeLimit;
35
+	private int | float $putSizeLimit;
36 36
 
37 37
 	/** @var int Limit on COPY in bytes (float is added for 32bit support) */
38
-	private int|float $copySizeLimit;
38
+	private int | float $copySizeLimit;
39 39
 
40 40
 	private bool $useMultipartCopy = true;
41 41
 
Please login to merge, or discard this patch.