Completed
Push — master ( 86560b...c68386 )
by
unknown
30:21
created
lib/private/Http/Client/Client.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
 		$options['nextcloud']['allow_local_address'] = $this->isLocalAddressAllowed($options);
62 62
 		if ($options['nextcloud']['allow_local_address'] === false) {
63
-			$onRedirectFunction = function (
63
+			$onRedirectFunction = function(
64 64
 				\Psr\Http\Message\RequestInterface $request,
65 65
 				\Psr\Http\Message\ResponseInterface $response,
66 66
 				\Psr\Http\Message\UriInterface $uri,
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 		$options = array_merge($defaults, $options);
84 84
 
85 85
 		if (!isset($options[RequestOptions::HEADERS]['User-Agent'])) {
86
-			$userAgent = 'Nextcloud-Server-Crawler/' . $this->serverVersion->getVersionString();
86
+			$userAgent = 'Nextcloud-Server-Crawler/'.$this->serverVersion->getVersionString();
87 87
 			$options[RequestOptions::HEADERS]['User-Agent'] = $userAgent;
88 88
 		}
89 89
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 
136 136
 		$proxyUserPwd = $this->config->getSystemValueString('proxyuserpwd', '');
137 137
 		if ($proxyUserPwd !== '') {
138
-			$proxyHost = $proxyUserPwd . '@' . $proxyHost;
138
+			$proxyHost = $proxyUserPwd.'@'.$proxyHost;
139 139
 		}
140 140
 
141 141
 		$proxy = [
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 		}
172 172
 
173 173
 		if (!$this->remoteHostValidator->isValid($host)) {
174
-			throw new LocalServerException('Host "' . $host . '" violates local access rules');
174
+			throw new LocalServerException('Host "'.$host.'" violates local access rules');
175 175
 		}
176 176
 	}
177 177
 
Please login to merge, or discard this patch.
lib/private/Files/ObjectStore/S3ConnectionTrait.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 			throw new \Exception('Bucket has to be configured.');
40 40
 		}
41 41
 
42
-		$this->id = 'amazon::' . $params['bucket'];
42
+		$this->id = 'amazon::'.$params['bucket'];
43 43
 
44 44
 		$this->test = isset($params['test']);
45 45
 		$this->bucket = $params['bucket'];
@@ -52,10 +52,10 @@  discard block
 block discarded – undo
52 52
 		$this->uploadPartSize = $params['uploadPartSize'] ?? 524288000;
53 53
 		$this->putSizeLimit = $params['putSizeLimit'] ?? 104857600;
54 54
 		$this->copySizeLimit = $params['copySizeLimit'] ?? 5242880000;
55
-		$this->useMultipartCopy = (bool)($params['useMultipartCopy'] ?? true);
55
+		$this->useMultipartCopy = (bool) ($params['useMultipartCopy'] ?? true);
56 56
 		$this->retriesMaxAttempts = $params['retriesMaxAttempts'] ?? 5;
57 57
 		$params['region'] = empty($params['region']) ? 'eu-west-1' : $params['region'];
58
-		$params['hostname'] = empty($params['hostname']) ? 's3.' . $params['region'] . '.amazonaws.com' : $params['hostname'];
58
+		$params['hostname'] = empty($params['hostname']) ? 's3.'.$params['region'].'.amazonaws.com' : $params['hostname'];
59 59
 		$params['s3-accelerate'] = $params['hostname'] === 's3-accelerate.amazonaws.com' || $params['hostname'] === 's3-accelerate.dualstack.amazonaws.com';
60 60
 		if (!isset($params['port']) || $params['port'] === '') {
61 61
 			$params['port'] = (isset($params['use_ssl']) && $params['use_ssl'] === false) ? 80 : 443;
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 		}
95 95
 
96 96
 		$scheme = (isset($this->params['use_ssl']) && $this->params['use_ssl'] === false) ? 'http' : 'https';
97
-		$base_url = $scheme . '://' . $this->params['hostname'] . ':' . $this->params['port'] . '/';
97
+		$base_url = $scheme.'://'.$this->params['hostname'].':'.$this->params['port'].'/';
98 98
 
99 99
 		// Adding explicit credential provider to the beginning chain.
100 100
 		// Including default credential provider (skipping AWS shared config files).
@@ -150,20 +150,20 @@  discard block
 block discarded – undo
150 150
 		try {
151 151
 			$logger = Server::get(LoggerInterface::class);
152 152
 			if (!$this->connection::isBucketDnsCompatible($this->bucket)) {
153
-				$logger->debug('Bucket "' . $this->bucket . '" This bucket name is not dns compatible, it may contain invalid characters.',
153
+				$logger->debug('Bucket "'.$this->bucket.'" This bucket name is not dns compatible, it may contain invalid characters.',
154 154
 					['app' => 'objectstore']);
155 155
 			}
156 156
 
157 157
 			if ($this->params['verify_bucket_exists']) {
158
-				$cacheKey = $this->params['hostname'] . $this->bucket;
158
+				$cacheKey = $this->params['hostname'].$this->bucket;
159 159
 				$exist = $this->existingBucketsCache->get($cacheKey) === 1;
160 160
 
161 161
 				if (!$exist) {
162 162
 					if (!$this->connection->doesBucketExist($this->bucket)) {
163 163
 						try {
164
-							$logger->info('Bucket "' . $this->bucket . '" does not exist - creating it.', ['app' => 'objectstore']);
164
+							$logger->info('Bucket "'.$this->bucket.'" does not exist - creating it.', ['app' => 'objectstore']);
165 165
 							if (!$this->connection::isBucketDnsCompatible($this->bucket)) {
166
-								throw new StorageNotAvailableException('The bucket will not be created because the name is not dns compatible, please correct it: ' . $this->bucket);
166
+								throw new StorageNotAvailableException('The bucket will not be created because the name is not dns compatible, please correct it: '.$this->bucket);
167 167
 							}
168 168
 							$this->connection->createBucket(['Bucket' => $this->bucket]);
169 169
 							Server::get(IEventDispatcher::class)
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 								'app' => 'objectstore',
181 181
 							]);
182 182
 							if ($e->getAwsErrorCode() !== 'BucketAlreadyOwnedByYou') {
183
-								throw new StorageNotAvailableException('Creation of bucket "' . $this->bucket . '" failed. ' . $e->getMessage());
183
+								throw new StorageNotAvailableException('Creation of bucket "'.$this->bucket.'" failed. '.$e->getMessage());
184 184
 							}
185 185
 						}
186 186
 					}
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 				$this->connection->getHandlerList()->remove('s3.auto_encode');
194 194
 			}
195 195
 		} catch (S3Exception $e) {
196
-			throw new StorageNotAvailableException('S3 service is unable to handle request: ' . $e->getMessage());
196
+			throw new StorageNotAvailableException('S3 service is unable to handle request: '.$e->getMessage());
197 197
 		}
198 198
 
199 199
 		return $this->connection;
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 * This function creates a credential provider based on user parameter file
223 223
 	 */
224 224
 	protected function paramCredentialProvider(): callable {
225
-		return function () {
225
+		return function() {
226 226
 			$key = empty($this->params['key']) ? null : $this->params['key'];
227 227
 			$secret = empty($this->params['secret']) ? null : $this->params['secret'];
228 228
 			$sessionToken = empty($this->params['session_token']) ? null : $this->params['session_token'];
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	}
241 241
 
242 242
 	protected function getCertificateBundlePath(): ?string {
243
-		if ((int)($this->params['use_nextcloud_bundle'] ?? '0')) {
243
+		if ((int) ($this->params['use_nextcloud_bundle'] ?? '0')) {
244 244
 			/** @var ICertificateManager $certManager */
245 245
 			$certManager = Server::get(ICertificateManager::class);
246 246
 			// since we store the certificate bundles on the primary storage, we can't get the bundle while setting up the primary storage
Please login to merge, or discard this patch.
lib/private/Security/CertificateManager.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 			return [];
40 40
 		}
41 41
 
42
-		$path = $this->getPathToCertificates() . 'uploads/';
42
+		$path = $this->getPathToCertificates().'uploads/';
43 43
 		if (!$this->view->is_dir($path)) {
44 44
 			return [];
45 45
 		}
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 		while (false !== ($file = readdir($handle))) {
52 52
 			if ($file != '.' && $file != '..') {
53 53
 				try {
54
-					$content = $this->view->file_get_contents($path . $file);
54
+					$content = $this->view->file_get_contents($path.$file);
55 55
 					if ($content !== false) {
56 56
 						$result[] = new Certificate($content, $file);
57 57
 					} else {
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 			return false;
72 72
 		}
73 73
 
74
-		$path = $this->getPathToCertificates() . 'uploads/';
74
+		$path = $this->getPathToCertificates().'uploads/';
75 75
 		if (!$this->view->is_dir($path)) {
76 76
 			return false;
77 77
 		}
@@ -108,17 +108,17 @@  discard block
 block discarded – undo
108 108
 			return;
109 109
 		}
110 110
 
111
-		$certPath = $path . 'rootcerts.crt';
112
-		$tmpPath = $certPath . '.tmp' . $this->random->generate(10, ISecureRandom::CHAR_DIGITS);
111
+		$certPath = $path.'rootcerts.crt';
112
+		$tmpPath = $certPath.'.tmp'.$this->random->generate(10, ISecureRandom::CHAR_DIGITS);
113 113
 		$fhCerts = $this->view->fopen($tmpPath, 'w');
114 114
 
115 115
 		if (!is_resource($fhCerts)) {
116
-			throw new \RuntimeException('Unable to open file handler to create certificate bundle "' . $tmpPath . '".');
116
+			throw new \RuntimeException('Unable to open file handler to create certificate bundle "'.$tmpPath.'".');
117 117
 		}
118 118
 
119 119
 		// Write user certificates
120 120
 		foreach ($certs as $cert) {
121
-			$file = $path . '/uploads/' . $cert->getName();
121
+			$file = $path.'/uploads/'.$cert->getName();
122 122
 			$data = $this->view->file_get_contents($file);
123 123
 			if (strpos($data, 'BEGIN CERTIFICATE')) {
124 124
 				fwrite($fhCerts, $data);
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	 * @throws \Exception If the certificate could not get added
150 150
 	 */
151 151
 	public function addCertificate(string $certificate, string $name): ICertificate {
152
-		$path = $this->getPathToCertificates() . 'uploads/' . $name;
152
+		$path = $this->getPathToCertificates().'uploads/'.$name;
153 153
 		$directory = dirname($path);
154 154
 
155 155
 		$this->view->verifyPath($directory, basename($path));
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 	 * Remove the certificate and re-generate the certificate bundle
174 174
 	 */
175 175
 	public function removeCertificate(string $name): bool {
176
-		$path = $this->getPathToCertificates() . 'uploads/' . $name;
176
+		$path = $this->getPathToCertificates().'uploads/'.$name;
177 177
 
178 178
 		try {
179 179
 			$this->view->verifyPath(dirname($path), basename($path));
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 * Get the path to the certificate bundle
194 194
 	 */
195 195
 	public function getCertificateBundle(): string {
196
-		return $this->getPathToCertificates() . 'rootcerts.crt';
196
+		return $this->getPathToCertificates().'rootcerts.crt';
197 197
 	}
198 198
 
199 199
 	/**
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 					$this->bundlePath = $this->view->getLocalFile($certificateBundle) ?: null;
215 215
 
216 216
 					if ($this->bundlePath === null) {
217
-						throw new \RuntimeException('Unable to get certificate bundle "' . $certificateBundle . '".');
217
+						throw new \RuntimeException('Unable to get certificate bundle "'.$certificateBundle.'".');
218 218
 					}
219 219
 				}
220 220
 			}
@@ -250,6 +250,6 @@  discard block
 block discarded – undo
250 250
 	}
251 251
 
252 252
 	public function getDefaultCertificatesBundlePath(): string {
253
-		return $this->config->getSystemValueString('default_certificates_bundle_path', \OC::$SERVERROOT . '/resources/config/ca-bundle.crt');
253
+		return $this->config->getSystemValueString('default_certificates_bundle_path', \OC::$SERVERROOT.'/resources/config/ca-bundle.crt');
254 254
 	}
255 255
 }
Please login to merge, or discard this patch.
config/config.sample.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1797,7 +1797,7 @@  discard block
 block discarded – undo
1797 1797
 	 * https://github.com/phpredis/phpredis/commit/c5994f2a42b8a348af92d3acb4edff1328ad8ce1
1798 1798
 	 */
1799 1799
 	'redis.cluster' => [
1800
-		'seeds' => [ // provide some or all of the cluster servers to bootstrap discovery, port required
1800
+		'seeds' => [// provide some or all of the cluster servers to bootstrap discovery, port required
1801 1801
 			'localhost:7000',
1802 1802
 			'localhost:7001',
1803 1803
 		],
@@ -2885,5 +2885,5 @@  discard block
 block discarded – undo
2885 2885
 	 *
2886 2886
 	 * Defaults to `\OC::$SERVERROOT . '/resources/config/ca-bundle.crt'`.
2887 2887
 	 */
2888
-	'default_certificates_bundle_path' => \OC::$SERVERROOT . '/resources/config/ca-bundle.crt',
2888
+	'default_certificates_bundle_path' => \OC::$SERVERROOT.'/resources/config/ca-bundle.crt',
2889 2889
 ];
Please login to merge, or discard this patch.
tests/lib/Http/Client/ClientTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -476,13 +476,13 @@  discard block
 block discarded – undo
476 476
 		$this->certificateManager
477 477
 			->expects($this->once())
478 478
 			->method('getDefaultCertificatesBundlePath')
479
-			->willReturn(\OC::$SERVERROOT . '/resources/config/ca-bundle.crt');
479
+			->willReturn(\OC::$SERVERROOT.'/resources/config/ca-bundle.crt');
480 480
 
481 481
 		$this->serverVersion->method('getVersionString')
482 482
 			->willReturn('123.45.6');
483 483
 
484 484
 		$this->assertEquals([
485
-			'verify' => \OC::$SERVERROOT . '/resources/config/ca-bundle.crt',
485
+			'verify' => \OC::$SERVERROOT.'/resources/config/ca-bundle.crt',
486 486
 			'headers' => [
487 487
 				'User-Agent' => 'Nextcloud-Server-Crawler/123.45.6',
488 488
 				'Accept-Encoding' => 'gzip',
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
 				'allow_local_address' => false,
493 493
 			],
494 494
 			'allow_redirects' => [
495
-				'on_redirect' => function (
495
+				'on_redirect' => function(
496 496
 					\Psr\Http\Message\RequestInterface $request,
497 497
 					\Psr\Http\Message\ResponseInterface $response,
498 498
 					\Psr\Http\Message\UriInterface $uri,
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 				'allow_local_address' => false,
547 547
 			],
548 548
 			'allow_redirects' => [
549
-				'on_redirect' => function (
549
+				'on_redirect' => function(
550 550
 					\Psr\Http\Message\RequestInterface $request,
551 551
 					\Psr\Http\Message\ResponseInterface $response,
552 552
 					\Psr\Http\Message\UriInterface $uri,
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 				'allow_local_address' => false,
602 602
 			],
603 603
 			'allow_redirects' => [
604
-				'on_redirect' => function (
604
+				'on_redirect' => function(
605 605
 					\Psr\Http\Message\RequestInterface $request,
606 606
 					\Psr\Http\Message\ResponseInterface $response,
607 607
 					\Psr\Http\Message\UriInterface $uri,
Please login to merge, or discard this patch.
tests/lib/Security/CertificateManagerTest.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 		$this->createUser($this->username, '');
43 43
 
44 44
 		$storage = new Temporary();
45
-		$this->registerMount($this->username, $storage, '/' . $this->username . '/');
45
+		$this->registerMount($this->username, $storage, '/'.$this->username.'/');
46 46
 
47 47
 		\OC_Util::tearDownFS();
48 48
 		\OC_User::setUserId($this->username);
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
 		$config
56 56
 			->expects($this->any())
57 57
 			->method('getSystemValueString')
58
-			->with('default_certificates_bundle_path', \OC::$SERVERROOT . '/resources/config/ca-bundle.crt')
59
-			->willReturn(\OC::$SERVERROOT . '/resources/config/ca-bundle.crt');
58
+			->with('default_certificates_bundle_path', \OC::$SERVERROOT.'/resources/config/ca-bundle.crt')
59
+			->willReturn(\OC::$SERVERROOT.'/resources/config/ca-bundle.crt');
60 60
 
61 61
 		$this->random = $this->createMock(ISecureRandom::class);
62 62
 		$this->random->method('generate')
@@ -90,14 +90,14 @@  discard block
 block discarded – undo
90 90
 		$this->assertSame([], $this->certificateManager->listCertificates());
91 91
 
92 92
 		// Add some certificates
93
-		$this->certificateManager->addCertificate(file_get_contents(__DIR__ . '/../../data/certificates/goodCertificate.crt'), 'GoodCertificate');
93
+		$this->certificateManager->addCertificate(file_get_contents(__DIR__.'/../../data/certificates/goodCertificate.crt'), 'GoodCertificate');
94 94
 		$certificateStore = [];
95
-		$certificateStore[] = new Certificate(file_get_contents(__DIR__ . '/../../data/certificates/goodCertificate.crt'), 'GoodCertificate');
95
+		$certificateStore[] = new Certificate(file_get_contents(__DIR__.'/../../data/certificates/goodCertificate.crt'), 'GoodCertificate');
96 96
 		$this->assertEqualsArrays($certificateStore, $this->certificateManager->listCertificates());
97 97
 
98 98
 		// Add another certificates
99
-		$this->certificateManager->addCertificate(file_get_contents(__DIR__ . '/../../data/certificates/expiredCertificate.crt'), 'ExpiredCertificate');
100
-		$certificateStore[] = new Certificate(file_get_contents(__DIR__ . '/../../data/certificates/expiredCertificate.crt'), 'ExpiredCertificate');
99
+		$this->certificateManager->addCertificate(file_get_contents(__DIR__.'/../../data/certificates/expiredCertificate.crt'), 'ExpiredCertificate');
100
+		$certificateStore[] = new Certificate(file_get_contents(__DIR__.'/../../data/certificates/expiredCertificate.crt'), 'ExpiredCertificate');
101 101
 		$this->assertEqualsArrays($certificateStore, $this->certificateManager->listCertificates());
102 102
 	}
103 103
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 	#[\PHPUnit\Framework\Attributes\DataProvider('dangerousFileProvider')]
124 124
 	public function testAddDangerousFile($filename): void {
125 125
 		$this->expectException(InvalidPathException::class);
126
-		$this->certificateManager->addCertificate(file_get_contents(__DIR__ . '/../../data/certificates/expiredCertificate.crt'), $filename);
126
+		$this->certificateManager->addCertificate(file_get_contents(__DIR__.'/../../data/certificates/expiredCertificate.crt'), $filename);
127 127
 	}
128 128
 
129 129
 	public function testRemoveDangerousFile(): void {
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	}
132 132
 
133 133
 	public function testRemoveExistingFile(): void {
134
-		$this->certificateManager->addCertificate(file_get_contents(__DIR__ . '/../../data/certificates/goodCertificate.crt'), 'GoodCertificate');
134
+		$this->certificateManager->addCertificate(file_get_contents(__DIR__.'/../../data/certificates/goodCertificate.crt'), 'GoodCertificate');
135 135
 		$this->assertTrue($this->certificateManager->removeCertificate('GoodCertificate'));
136 136
 	}
137 137
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 
175 175
 
176 176
 		$view->expects($this->any())->method('filemtime')
177
-			->willReturnCallback(function ($path) use ($targetBundleMtime) {
177
+			->willReturnCallback(function($path) use ($targetBundleMtime) {
178 178
 				if ($path === 'targetBundlePath') {
179 179
 					return $targetBundleMtime;
180 180
 				}
Please login to merge, or discard this patch.