Passed
Push — master ( 0b39e7...65b5e6 )
by Morris
13:40 queued 28s
created
lib/private/Encryption/Keys/Storage.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
 		$this->util = $util;
81 81
 
82 82
 		$this->encryption_base_dir = '/files_encryption';
83
-		$this->keys_base_dir = $this->encryption_base_dir .'/keys';
84
-		$this->backup_base_dir = $this->encryption_base_dir .'/backup';
83
+		$this->keys_base_dir = $this->encryption_base_dir.'/keys';
84
+		$this->backup_base_dir = $this->encryption_base_dir.'/backup';
85 85
 		$this->root_dir = $this->util->getKeyStorageRoot();
86 86
 		$this->crypto = $crypto;
87 87
 		$this->config = $config;
@@ -101,14 +101,14 @@  discard block
 block discarded – undo
101 101
 	public function getFileKey($path, $keyId, $encryptionModuleId) {
102 102
 		$realFile = $this->util->stripPartialFileExtension($path);
103 103
 		$keyDir = $this->getFileKeyDir($encryptionModuleId, $realFile);
104
-		$key = $this->getKey($keyDir . $keyId)['key'];
104
+		$key = $this->getKey($keyDir.$keyId)['key'];
105 105
 
106 106
 		if ($key === '' && $realFile !== $path) {
107 107
 			// Check if the part file has keys and use them, if no normal keys
108 108
 			// exist. This is required to fix copyBetweenStorage() when we
109 109
 			// rename a .part file over storage borders.
110 110
 			$keyDir = $this->getFileKeyDir($encryptionModuleId, $path);
111
-			$key = $this->getKey($keyDir . $keyId)['key'];
111
+			$key = $this->getKey($keyDir.$keyId)['key'];
112 112
 		}
113 113
 
114 114
 		return base64_decode($key);
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	public function setFileKey($path, $keyId, $key, $encryptionModuleId) {
140 140
 		$keyDir = $this->getFileKeyDir($encryptionModuleId, $path);
141
-		return $this->setKey($keyDir . $keyId, [
141
+		return $this->setKey($keyDir.$keyId, [
142 142
 			'key' => base64_encode($key),
143 143
 		]);
144 144
 	}
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	 */
181 181
 	public function deleteFileKey($path, $keyId, $encryptionModuleId) {
182 182
 		$keyDir = $this->getFileKeyDir($encryptionModuleId, $path);
183
-		return !$this->view->file_exists($keyDir . $keyId) || $this->view->unlink($keyDir . $keyId);
183
+		return !$this->view->file_exists($keyDir.$keyId) || $this->view->unlink($keyDir.$keyId);
184 184
 	}
185 185
 
186 186
 	/**
@@ -209,10 +209,10 @@  discard block
 block discarded – undo
209 209
 	 */
210 210
 	protected function constructUserKeyPath($encryptionModuleId, $keyId, $uid) {
211 211
 		if ($uid === null) {
212
-			$path = $this->root_dir . '/' . $this->encryption_base_dir . '/' . $encryptionModuleId . '/' . $keyId;
212
+			$path = $this->root_dir.'/'.$this->encryption_base_dir.'/'.$encryptionModuleId.'/'.$keyId;
213 213
 		} else {
214
-			$path = $this->root_dir . '/' . $uid . $this->encryption_base_dir . '/'
215
-				. $encryptionModuleId . '/' . $uid . '.' . $keyId;
214
+			$path = $this->root_dir.'/'.$uid.$this->encryption_base_dir.'/'
215
+				. $encryptionModuleId.'/'.$uid.'.'.$keyId;
216 216
 		}
217 217
 
218 218
 		return \OC\Files\Filesystem::normalizePath($path);
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 
270 270
 		if ($this->view->file_exists($path)) {
271 271
 			if (isset($this->keyCache[$path])) {
272
-				$key =  $this->keyCache[$path];
272
+				$key = $this->keyCache[$path];
273 273
 			} else {
274 274
 				$data = $this->view->file_get_contents($path);
275 275
 
@@ -369,12 +369,12 @@  discard block
 block discarded – undo
369 369
 
370 370
 		// in case of system wide mount points the keys are stored directly in the data directory
371 371
 		if ($this->util->isSystemWideMountPoint($filename, $owner)) {
372
-			$keyPath = $this->root_dir . '/' . $this->keys_base_dir . $filename . '/';
372
+			$keyPath = $this->root_dir.'/'.$this->keys_base_dir.$filename.'/';
373 373
 		} else {
374
-			$keyPath = $this->root_dir . '/' . $owner . $this->keys_base_dir . $filename . '/';
374
+			$keyPath = $this->root_dir.'/'.$owner.$this->keys_base_dir.$filename.'/';
375 375
 		}
376 376
 
377
-		return Filesystem::normalizePath($keyPath . $encryptionModuleId . '/', false);
377
+		return Filesystem::normalizePath($keyPath.$encryptionModuleId.'/', false);
378 378
 	}
379 379
 
380 380
 	/**
@@ -429,13 +429,13 @@  discard block
 block discarded – undo
429 429
 	 * @since 12.0.0
430 430
 	 */
431 431
 	public function backupUserKeys($encryptionModuleId, $purpose, $uid) {
432
-		$source = $uid . $this->encryption_base_dir . '/' . $encryptionModuleId;
433
-		$backupDir = $uid . $this->backup_base_dir;
432
+		$source = $uid.$this->encryption_base_dir.'/'.$encryptionModuleId;
433
+		$backupDir = $uid.$this->backup_base_dir;
434 434
 		if (!$this->view->file_exists($backupDir)) {
435 435
 			$this->view->mkdir($backupDir);
436 436
 		}
437 437
 
438
-		$backupDir = $backupDir . '/' . $purpose . '.' . $encryptionModuleId . '.' . $this->getTimestamp();
438
+		$backupDir = $backupDir.'/'.$purpose.'.'.$encryptionModuleId.'.'.$this->getTimestamp();
439 439
 		$this->view->mkdir($backupDir);
440 440
 
441 441
 		return $this->view->copy($source, $backupDir);
@@ -461,9 +461,9 @@  discard block
 block discarded – undo
461 461
 		$systemWideMountPoint = $this->util->isSystemWideMountPoint($relativePath, $owner);
462 462
 
463 463
 		if ($systemWideMountPoint) {
464
-			$systemPath = $this->root_dir . '/' . $this->keys_base_dir . $relativePath . '/';
464
+			$systemPath = $this->root_dir.'/'.$this->keys_base_dir.$relativePath.'/';
465 465
 		} else {
466
-			$systemPath = $this->root_dir . '/' . $owner . $this->keys_base_dir . $relativePath . '/';
466
+			$systemPath = $this->root_dir.'/'.$owner.$this->keys_base_dir.$relativePath.'/';
467 467
 		}
468 468
 
469 469
 		return  Filesystem::normalizePath($systemPath, false);
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 			$sub_dirs = explode('/', ltrim($path, '/'));
481 481
 			$dir = '';
482 482
 			foreach ($sub_dirs as $sub_dir) {
483
-				$dir .= '/' . $sub_dir;
483
+				$dir .= '/'.$sub_dir;
484 484
 				if (!$this->view->is_dir($dir)) {
485 485
 					$this->view->mkdir($dir);
486 486
 				}
Please login to merge, or discard this patch.
core/Command/Encryption/MigrateKeyStorage.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
 	 * @param string $root
109 109
 	 */
110 110
 	protected function updateSystemKeys($root) {
111
-		if (!$this->rootView->is_dir($root . '/files_encryption')) {
111
+		if (!$this->rootView->is_dir($root.'/files_encryption')) {
112 112
 			return;
113 113
 		}
114 114
 
115
-		$this->traverseKeys($root . '/files_encryption', null);
115
+		$this->traverseKeys($root.'/files_encryption', null);
116 116
 	}
117 117
 
118 118
 	private function traverseKeys(string $folder, ?string $uid) {
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 			if ($node['mimetype'] === 'httpd/unix-directory') {
123 123
 				//ignore
124 124
 			} else {
125
-				$endsWith = function ($haystack, $needle) {
125
+				$endsWith = function($haystack, $needle) {
126 126
 					$length = strlen($needle);
127 127
 					if ($length === 0) {
128 128
 						return true;
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 					$endsWith($node['name'], '.privateKey') ||
136 136
 					$endsWith($node['name'], '.publicKey') ||
137 137
 					$endsWith($node['name'], '.shareKey')) {
138
-					$path = $folder . '/' . $node['name'];
138
+					$path = $folder.'/'.$node['name'];
139 139
 
140 140
 					$content = $this->rootView->file_get_contents($path);
141 141
 
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
 
164 164
 		foreach ($listing as $node) {
165 165
 			if ($node['mimetype'] === 'httpd/unix-directory') {
166
-				$this->traverseFileKeys($folder . '/' . $node['name']);
166
+				$this->traverseFileKeys($folder.'/'.$node['name']);
167 167
 			} else {
168
-				$endsWith = function ($haystack, $needle) {
168
+				$endsWith = function($haystack, $needle) {
169 169
 					$length = strlen($needle);
170 170
 					if ($length === 0) {
171 171
 						return true;
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 					$endsWith($node['name'], '.privateKey') ||
179 179
 					$endsWith($node['name'], '.publicKey') ||
180 180
 					$endsWith($node['name'], '.shareKey')) {
181
-					$path = $folder . '/' . $node['name'];
181
+					$path = $folder.'/'.$node['name'];
182 182
 
183 183
 					$content = $this->rootView->file_get_contents($path);
184 184
 
@@ -247,12 +247,12 @@  discard block
 block discarded – undo
247 247
 	 */
248 248
 	protected function updateUserKeys(string $root, string $user) {
249 249
 		if ($this->userManager->userExists($user)) {
250
-			$source = $root . '/' . $user . '/files_encryption/OC_DEFAULT_MODULE';
250
+			$source = $root.'/'.$user.'/files_encryption/OC_DEFAULT_MODULE';
251 251
 			if ($this->rootView->is_dir($source)) {
252 252
 				$this->traverseKeys($source, $user);
253 253
 			}
254 254
 
255
-			$source = $root . '/' . $user . '/files_encryption/keys';
255
+			$source = $root.'/'.$user.'/files_encryption/keys';
256 256
 			if ($this->rootView->is_dir($source)) {
257 257
 				$this->traverseFileKeys($source);
258 258
 			}
Please login to merge, or discard this patch.