Passed
Push — master ( 32f79c...03cdff )
by Roeland
10:27 queued 11s
created
apps/user_ldap/lib/Jobs/UpdateGroups.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -50,14 +50,14 @@  discard block
 block discarded – undo
50 50
 
51 51
 	static private $groupBE;
52 52
 
53
-	public function __construct(){
53
+	public function __construct() {
54 54
 		$this->interval = self::getRefreshInterval();
55 55
 	}
56 56
 
57 57
 	/**
58 58
 	 * @param mixed $argument
59 59
 	 */
60
-	public function run($argument){
60
+	public function run($argument) {
61 61
 		self::updateGroups();
62 62
 	}
63 63
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		$knownGroups = array_keys(self::getKnownGroups());
68 68
 		$actualGroups = self::getGroupBE()->getGroups();
69 69
 
70
-		if(empty($actualGroups) && empty($knownGroups)) {
70
+		if (empty($actualGroups) && empty($knownGroups)) {
71 71
 			\OCP\Util::writeLog('user_ldap',
72 72
 				'bgJ "updateGroups" – groups do not seem to be configured properly, aborting.',
73 73
 				ILogger::INFO);
@@ -99,26 +99,26 @@  discard block
 block discarded – undo
99 99
 			SET `owncloudusers` = ?
100 100
 			WHERE `owncloudname` = ?
101 101
 		');
102
-		foreach($groups as $group) {
102
+		foreach ($groups as $group) {
103 103
 			//we assume, that self::$groupsFromDB has been retrieved already
104 104
 			$knownUsers = unserialize(self::$groupsFromDB[$group]['owncloudusers']);
105 105
 			$actualUsers = self::getGroupBE()->usersInGroup($group);
106 106
 			$hasChanged = false;
107
-			foreach(array_diff($knownUsers, $actualUsers) as $removedUser) {
107
+			foreach (array_diff($knownUsers, $actualUsers) as $removedUser) {
108 108
 				\OCP\Util::emitHook('OC_User', 'post_removeFromGroup', array('uid' => $removedUser, 'gid' => $group));
109 109
 				\OCP\Util::writeLog('user_ldap',
110 110
 				'bgJ "updateGroups" – "'.$removedUser.'" removed from "'.$group.'".',
111 111
 					ILogger::INFO);
112 112
 				$hasChanged = true;
113 113
 			}
114
-			foreach(array_diff($actualUsers, $knownUsers) as $addedUser) {
114
+			foreach (array_diff($actualUsers, $knownUsers) as $addedUser) {
115 115
 				\OCP\Util::emitHook('OC_User', 'post_addToGroup', array('uid' => $addedUser, 'gid' => $group));
116 116
 				\OCP\Util::writeLog('user_ldap',
117 117
 				'bgJ "updateGroups" – "'.$addedUser.'" added to "'.$group.'".',
118 118
 					ILogger::INFO);
119 119
 				$hasChanged = true;
120 120
 			}
121
-			if($hasChanged) {
121
+			if ($hasChanged) {
122 122
 				$query->execute(array(serialize($actualUsers), $group));
123 123
 			}
124 124
 		}
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 			INTO `*PREFIX*ldap_group_members` (`owncloudname`, `owncloudusers`)
138 138
 			VALUES (?, ?)
139 139
 		');
140
-		foreach($createdGroups as $createdGroup) {
140
+		foreach ($createdGroups as $createdGroup) {
141 141
 			\OCP\Util::writeLog('user_ldap',
142 142
 				'bgJ "updateGroups" – new group "'.$createdGroup.'" found.',
143 143
 				ILogger::INFO);
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 			FROM `*PREFIX*ldap_group_members`
160 160
 			WHERE `owncloudname` = ?
161 161
 		');
162
-		foreach($removedGroups as $removedGroup) {
162
+		foreach ($removedGroups as $removedGroup) {
163 163
 			\OCP\Util::writeLog('user_ldap',
164 164
 				'bgJ "updateGroups" – group "'.$removedGroup.'" was removed.',
165 165
 				ILogger::INFO);
@@ -174,13 +174,13 @@  discard block
 block discarded – undo
174 174
 	 * @return \OCA\User_LDAP\Group_LDAP|\OCA\User_LDAP\Group_Proxy
175 175
 	 */
176 176
 	static private function getGroupBE() {
177
-		if(!is_null(self::$groupBE)) {
177
+		if (!is_null(self::$groupBE)) {
178 178
 			return self::$groupBE;
179 179
 		}
180 180
 		$helper = new Helper(\OC::$server->getConfig());
181 181
 		$configPrefixes = $helper->getServerConfigurationPrefixes(true);
182 182
 		$ldapWrapper = new LDAP();
183
-		if(count($configPrefixes) === 1) {
183
+		if (count($configPrefixes) === 1) {
184 184
 			//avoid the proxy when there is only one LDAP server configured
185 185
 			$dbc = \OC::$server->getDatabaseConnection();
186 186
 			$userManager = new Manager(
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	 * @return array
211 211
 	 */
212 212
 	static private function getKnownGroups() {
213
-		if(is_array(self::$groupsFromDB)) {
213
+		if (is_array(self::$groupsFromDB)) {
214 214
 			return self::$groupsFromDB;
215 215
 		}
216 216
 		$query = \OC_DB::prepare('
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 		');
220 220
 		$result = $query->execute()->fetchAll();
221 221
 		self::$groupsFromDB = array();
222
-		foreach($result as $dataset) {
222
+		foreach ($result as $dataset) {
223 223
 			self::$groupsFromDB[$dataset['owncloudname']] = $dataset;
224 224
 		}
225 225
 
Please login to merge, or discard this patch.
apps/encryption/lib/KeyManager.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 		$this->recoveryKeyId = $this->config->getAppValue('encryption',
129 129
 			'recoveryKeyId');
130 130
 		if (empty($this->recoveryKeyId)) {
131
-			$this->recoveryKeyId = 'recoveryKey_' . substr(md5(time()), 0, 8);
131
+			$this->recoveryKeyId = 'recoveryKey_'.substr(md5(time()), 0, 8);
132 132
 			$this->config->setAppValue('encryption',
133 133
 				'recoveryKeyId',
134 134
 				$this->recoveryKeyId);
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
137 137
 		$this->publicShareKeyId = $this->config->getAppValue('encryption',
138 138
 			'publicShareKeyId');
139 139
 		if (empty($this->publicShareKeyId)) {
140
-			$this->publicShareKeyId = 'pubShare_' . substr(md5(time()), 0, 8);
140
+			$this->publicShareKeyId = 'pubShare_'.substr(md5(time()), 0, 8);
141 141
 			$this->config->setAppValue('encryption', 'publicShareKeyId', $this->publicShareKeyId);
142 142
 		}
143 143
 
144 144
 		$this->masterKeyId = $this->config->getAppValue('encryption',
145 145
 			'masterKeyId');
146 146
 		if (empty($this->masterKeyId)) {
147
-			$this->masterKeyId = 'master_' . substr(md5(time()), 0, 8);
147
+			$this->masterKeyId = 'master_'.substr(md5(time()), 0, 8);
148 148
 			$this->config->setAppValue('encryption', 'masterKeyId', $this->masterKeyId);
149 149
 		}
150 150
 
@@ -162,13 +162,13 @@  discard block
 block discarded – undo
162 162
 
163 163
 			// Save public key
164 164
 			$this->keyStorage->setSystemUserKey(
165
-				$this->publicShareKeyId . '.publicKey', $keyPair['publicKey'],
165
+				$this->publicShareKeyId.'.publicKey', $keyPair['publicKey'],
166 166
 				Encryption::ID);
167 167
 
168 168
 			// Encrypt private key empty passphrase
169 169
 			$encryptedKey = $this->crypt->encryptPrivateKey($keyPair['privateKey'], '');
170 170
 			$header = $this->crypt->generateHeader();
171
-			$this->setSystemPrivateKey($this->publicShareKeyId, $header . $encryptedKey);
171
+			$this->setSystemPrivateKey($this->publicShareKeyId, $header.$encryptedKey);
172 172
 		}
173 173
 	}
174 174
 
@@ -187,13 +187,13 @@  discard block
 block discarded – undo
187 187
 
188 188
 			// Save public key
189 189
 			$this->keyStorage->setSystemUserKey(
190
-				$this->masterKeyId . '.publicKey', $keyPair['publicKey'],
190
+				$this->masterKeyId.'.publicKey', $keyPair['publicKey'],
191 191
 				Encryption::ID);
192 192
 
193 193
 			// Encrypt private key with system password
194 194
 			$encryptedKey = $this->crypt->encryptPrivateKey($keyPair['privateKey'], $this->getMasterKeyPassword(), $this->masterKeyId);
195 195
 			$header = $this->crypt->generateHeader();
196
-			$this->setSystemPrivateKey($this->masterKeyId, $header . $encryptedKey);
196
+			$this->setSystemPrivateKey($this->masterKeyId, $header.$encryptedKey);
197 197
 		}
198 198
 
199 199
 		if (!$this->session->isPrivateKeySet()) {
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 	 * @return string
221 221
 	 */
222 222
 	public function getRecoveryKey() {
223
-		return $this->keyStorage->getSystemUserKey($this->recoveryKeyId . '.publicKey', Encryption::ID);
223
+		return $this->keyStorage->getSystemUserKey($this->recoveryKeyId.'.publicKey', Encryption::ID);
224 224
 	}
225 225
 
226 226
 	/**
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 	 * @return bool
238 238
 	 */
239 239
 	public function checkRecoveryPassword($password) {
240
-		$recoveryKey = $this->keyStorage->getSystemUserKey($this->recoveryKeyId . '.privateKey', Encryption::ID);
240
+		$recoveryKey = $this->keyStorage->getSystemUserKey($this->recoveryKeyId.'.privateKey', Encryption::ID);
241 241
 		$decryptedRecoveryKey = $this->crypt->decryptPrivateKey($recoveryKey, $password);
242 242
 
243 243
 		if ($decryptedRecoveryKey) {
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 		$header = $this->crypt->generateHeader();
262 262
 
263 263
 		if ($encryptedKey) {
264
-			$this->setPrivateKey($uid, $header . $encryptedKey);
264
+			$this->setPrivateKey($uid, $header.$encryptedKey);
265 265
 			return true;
266 266
 		}
267 267
 		return false;
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 		$header = $this->crypt->generateHeader();
284 284
 
285 285
 		if ($encryptedKey) {
286
-			$this->setSystemPrivateKey($this->getRecoveryKeyId(), $header . $encryptedKey);
286
+			$this->setSystemPrivateKey($this->getRecoveryKeyId(), $header.$encryptedKey);
287 287
 			return true;
288 288
 		}
289 289
 		return false;
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 	 * @return boolean
344 344
 	 */
345 345
 	public function setShareKey($path, $uid, $key) {
346
-		$keyId = $uid . '.' . $this->shareKeyId;
346
+		$keyId = $uid.'.'.$this->shareKeyId;
347 347
 		return $this->keyStorage->setFileKey($path, $keyId, $key, Encryption::ID);
348 348
 	}
349 349
 
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 		$this->session->setStatus(Session::INIT_EXECUTED);
360 360
 
361 361
 		try {
362
-			if($this->util->isMasterKeyEnabled()) {
362
+			if ($this->util->isMasterKeyEnabled()) {
363 363
 				$uid = $this->getMasterKeyId();
364 364
 				$passPhrase = $this->getMasterKeyPassword();
365 365
 				$privateKey = $this->getSystemPrivateKey($uid);
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 			return false;
374 374
 		} catch (\Exception $e) {
375 375
 			$this->log->logException($e, [
376
-				'message' => 'Could not decrypt the private key from user "' . $uid . '"" during login. Assume password change on the user back-end.',
376
+				'message' => 'Could not decrypt the private key from user "'.$uid.'"" during login. Assume password change on the user back-end.',
377 377
 				'level' => ILogger::WARN,
378 378
 				'app' => 'encryption',
379 379
 			]);
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 			// use public share key for public links
435 435
 			$uid = $this->getPublicShareKeyId();
436 436
 			$shareKey = $this->getShareKey($path, $uid);
437
-			$privateKey = $this->keyStorage->getSystemUserKey($this->publicShareKeyId . '.privateKey', Encryption::ID);
437
+			$privateKey = $this->keyStorage->getSystemUserKey($this->publicShareKeyId.'.privateKey', Encryption::ID);
438 438
 			$privateKey = $this->crypt->decryptPrivateKey($privateKey);
439 439
 		} else {
440 440
 			$shareKey = $this->getShareKey($path, $uid);
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 	 */
460 460
 	public function getVersion($path, View $view) {
461 461
 		$fileInfo = $view->getFileInfo($path);
462
-		if($fileInfo === false) {
462
+		if ($fileInfo === false) {
463 463
 			return 0;
464 464
 		}
465 465
 		return $fileInfo->getEncryptedVersion();
@@ -473,9 +473,9 @@  discard block
 block discarded – undo
473 473
 	 * @param View $view
474 474
 	 */
475 475
 	public function setVersion($path, $version, View $view) {
476
-		$fileInfo= $view->getFileInfo($path);
476
+		$fileInfo = $view->getFileInfo($path);
477 477
 
478
-		if($fileInfo !== false) {
478
+		if ($fileInfo !== false) {
479 479
 			$cache = $fileInfo->getStorage()->getCache();
480 480
 			$cache->update($fileInfo->getId(), ['encrypted' => $version, 'encryptedVersion' => $version]);
481 481
 		}
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 	public function deleteShareKey($path, $keyId) {
505 505
 		return $this->keyStorage->deleteFileKey(
506 506
 			$path,
507
-			$keyId . '.' . $this->shareKeyId,
507
+			$keyId.'.'.$this->shareKeyId,
508 508
 			Encryption::ID);
509 509
 	}
510 510
 
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
 	 * @return mixed
516 516
 	 */
517 517
 	public function getShareKey($path, $uid) {
518
-		$keyId = $uid . '.' . $this->shareKeyId;
518
+		$keyId = $uid.'.'.$this->shareKeyId;
519 519
 		return $this->keyStorage->getFileKey($path, $keyId, Encryption::ID);
520 520
 	}
521 521
 
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 	 * @return string
578 578
 	 */
579 579
 	public function getPublicShareKey() {
580
-		return $this->keyStorage->getSystemUserKey($this->publicShareKeyId . '.publicKey', Encryption::ID);
580
+		return $this->keyStorage->getSystemUserKey($this->publicShareKeyId.'.publicKey', Encryption::ID);
581 581
 	}
582 582
 
583 583
 	/**
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
 	 * @return string returns openssl key
648 648
 	 */
649 649
 	public function getSystemPrivateKey($keyId) {
650
-		return $this->keyStorage->getSystemUserKey($keyId . '.' . $this->privateKeyId, Encryption::ID);
650
+		return $this->keyStorage->getSystemUserKey($keyId.'.'.$this->privateKeyId, Encryption::ID);
651 651
 	}
652 652
 
653 653
 	/**
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
 	 */
658 658
 	public function setSystemPrivateKey($keyId, $key) {
659 659
 		return $this->keyStorage->setSystemUserKey(
660
-			$keyId . '.' . $this->privateKeyId,
660
+			$keyId.'.'.$this->privateKeyId,
661 661
 			$key,
662 662
 			Encryption::ID);
663 663
 	}
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
 	 */
698 698
 	public function getMasterKeyPassword() {
699 699
 		$password = $this->config->getSystemValue('secret');
700
-		if (empty($password)){
700
+		if (empty($password)) {
701 701
 			throw new \Exception('Can not get secret from Nextcloud instance');
702 702
 		}
703 703
 
@@ -719,6 +719,6 @@  discard block
 block discarded – undo
719 719
 	 * @return string
720 720
 	 */
721 721
 	public function getPublicMasterKey() {
722
-		return $this->keyStorage->getSystemUserKey($this->masterKeyId . '.publicKey', Encryption::ID);
722
+		return $this->keyStorage->getSystemUserKey($this->masterKeyId.'.publicKey', Encryption::ID);
723 723
 	}
724 724
 }
Please login to merge, or discard this patch.
lib/autoloader.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -101,24 +101,24 @@  discard block
 block discarded – undo
101 101
 			 * Remove "apps/" from inclusion path for smooth migration to multi app dir
102 102
 			 */
103 103
 			if (strpos(\OC::$CLASSPATH[$class], 'apps/') === 0) {
104
-				\OCP\Util::writeLog('core', 'include path for class "' . $class . '" starts with "apps/"', ILogger::DEBUG);
104
+				\OCP\Util::writeLog('core', 'include path for class "'.$class.'" starts with "apps/"', ILogger::DEBUG);
105 105
 				$paths[] = str_replace('apps/', '', \OC::$CLASSPATH[$class]);
106 106
 			}
107 107
 		} elseif (strpos($class, 'OC_') === 0) {
108
-			$paths[] = \OC::$SERVERROOT . '/lib/private/legacy/' . strtolower(str_replace('_', '/', substr($class, 3)) . '.php');
108
+			$paths[] = \OC::$SERVERROOT.'/lib/private/legacy/'.strtolower(str_replace('_', '/', substr($class, 3)).'.php');
109 109
 		} elseif (strpos($class, 'OCA\\') === 0) {
110 110
 			list(, $app, $rest) = explode('\\', $class, 3);
111 111
 			$app = strtolower($app);
112 112
 			$appPath = \OC_App::getAppPath($app);
113 113
 			if ($appPath && stream_resolve_include_path($appPath)) {
114
-				$paths[] = $appPath . '/' . strtolower(str_replace('\\', '/', $rest) . '.php');
114
+				$paths[] = $appPath.'/'.strtolower(str_replace('\\', '/', $rest).'.php');
115 115
 				// If not found in the root of the app directory, insert '/lib' after app id and try again.
116
-				$paths[] = $appPath . '/lib/' . strtolower(str_replace('\\', '/', $rest) . '.php');
116
+				$paths[] = $appPath.'/lib/'.strtolower(str_replace('\\', '/', $rest).'.php');
117 117
 			}
118 118
 		} elseif ($class === 'Test\\TestCase') {
119 119
 			// This File is considered public API, so we make sure that the class
120 120
 			// can still be loaded, although the PSR-4 paths have not been loaded.
121
-			$paths[] = \OC::$SERVERROOT . '/tests/lib/TestCase.php';
121
+			$paths[] = \OC::$SERVERROOT.'/tests/lib/TestCase.php';
122 122
 		}
123 123
 		return $paths;
124 124
 	}
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 */
131 131
 	protected function isValidPath(string $fullPath): bool {
132 132
 		foreach ($this->validRoots as $root => $true) {
133
-			if (substr($fullPath, 0, strlen($root) + 1) === $root . '/') {
133
+			if (substr($fullPath, 0, strlen($root) + 1) === $root.'/') {
134 134
 				return true;
135 135
 			}
136 136
 		}
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 			$pathsToRequire = $this->memoryCache->get($class);
151 151
 		}
152 152
 
153
-		if(class_exists($class, false)) {
153
+		if (class_exists($class, false)) {
154 154
 			return false;
155 155
 		}
156 156
 
Please login to merge, or discard this patch.
lib/private/DateTimeZone.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 		try {
66 66
 			return new \DateTimeZone($timeZone);
67 67
 		} catch (\Exception $e) {
68
-			\OCP\Util::writeLog('datetimezone', 'Failed to created DateTimeZone "' . $timeZone . "'", ILogger::DEBUG);
68
+			\OCP\Util::writeLog('datetimezone', 'Failed to created DateTimeZone "'.$timeZone."'", ILogger::DEBUG);
69 69
 			return new \DateTimeZone($this->getDefaultTimeZone());
70 70
 		}
71 71
 	}
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
 			// so a positive offset means negative timeZone
87 87
 			// and the other way around.
88 88
 			if ($offset > 0) {
89
-				$timeZone = 'Etc/GMT-' . $offset;
89
+				$timeZone = 'Etc/GMT-'.$offset;
90 90
 			} else {
91
-				$timeZone = 'Etc/GMT+' . abs($offset);
91
+				$timeZone = 'Etc/GMT+'.abs($offset);
92 92
 			}
93 93
 
94 94
 			return new \DateTimeZone($timeZone);
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 			}
111 111
 
112 112
 			// No timezone found, fallback to UTC
113
-			\OCP\Util::writeLog('datetimezone', 'Failed to find DateTimeZone for offset "' . $offset . "'", ILogger::DEBUG);
113
+			\OCP\Util::writeLog('datetimezone', 'Failed to find DateTimeZone for offset "'.$offset."'", ILogger::DEBUG);
114 114
 			return new \DateTimeZone($this->getDefaultTimeZone());
115 115
 		}
116 116
 	}
Please login to merge, or discard this patch.
lib/private/Files/Mount/MountPoint.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 		} else {
107 107
 			// Update old classes to new namespace
108 108
 			if (strpos($storage, 'OC_Filestorage_') !== false) {
109
-				$storage = '\OC\Files\Storage\\' . substr($storage, 15);
109
+				$storage = '\OC\Files\Storage\\'.substr($storage, 15);
110 110
 			}
111 111
 			$this->class = $storage;
112 112
 			$this->arguments = $arguments;
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 				return;
159 159
 			}
160 160
 		} else {
161
-			\OCP\Util::writeLog('core', 'storage backend ' . $this->class . ' not found', ILogger::ERROR);
161
+			\OCP\Util::writeLog('core', 'storage backend '.$this->class.' not found', ILogger::ERROR);
162 162
 			$this->invalidStorage = true;
163 163
 			return;
164 164
 		}
@@ -208,13 +208,13 @@  discard block
 block discarded – undo
208 208
 	 */
209 209
 	public function getInternalPath($path) {
210 210
 		$path = Filesystem::normalizePath($path, true, false, true);
211
-		if ($this->mountPoint === $path or $this->mountPoint . '/' === $path) {
211
+		if ($this->mountPoint === $path or $this->mountPoint.'/' === $path) {
212 212
 			$internalPath = '';
213 213
 		} else {
214 214
 			$internalPath = substr($path, strlen($this->mountPoint));
215 215
 		}
216 216
 		// substr returns false instead of an empty string, we always want a string
217
-		return (string)$internalPath;
217
+		return (string) $internalPath;
218 218
 	}
219 219
 
220 220
 	/**
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 	 */
268 268
 	public function getStorageRootId() {
269 269
 		if (is_null($this->rootId)) {
270
-			$this->rootId = (int)$this->getStorage()->getCache()->getId('');
270
+			$this->rootId = (int) $this->getStorage()->getCache()->getId('');
271 271
 		}
272 272
 		return $this->rootId;
273 273
 	}
Please login to merge, or discard this patch.
lib/private/Files/Storage/Wrapper/Encryption.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -368,8 +368,8 @@  discard block
 block discarded – undo
368 368
 		// check if the file is stored in the array cache, this means that we
369 369
 		// copy a file over to the versions folder, in this case we don't want to
370 370
 		// decrypt it
371
-		if ($this->arrayCache->hasKey('encryption_copy_version_' . $path)) {
372
-			$this->arrayCache->remove('encryption_copy_version_' . $path);
371
+		if ($this->arrayCache->hasKey('encryption_copy_version_'.$path)) {
372
+			$this->arrayCache->remove('encryption_copy_version_'.$path);
373 373
 			return $this->storage->fopen($path, $mode);
374 374
 		}
375 375
 
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 				}
441 441
 			} catch (ModuleDoesNotExistsException $e) {
442 442
 				$this->logger->logException($e, [
443
-					'message' => 'Encryption module "' . $encryptionModuleId . '" not found, file will be stored unencrypted',
443
+					'message' => 'Encryption module "'.$encryptionModuleId.'" not found, file will be stored unencrypted',
444 444
 					'level' => ILogger::WARN,
445 445
 					'app' => 'core',
446 446
 				]);
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 				try {
496 496
 					$result = $this->fixUnencryptedSize($path, $size, $unencryptedSize);
497 497
 				} catch (\Exception $e) {
498
-					$this->logger->error('Couldn\'t re-calculate unencrypted size for '. $path);
498
+					$this->logger->error('Couldn\'t re-calculate unencrypted size for '.$path);
499 499
 					$this->logger->logException($e);
500 500
 				}
501 501
 				unset($this->fixUnencryptedSizeOf[$this->getFullPath($path)]);
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 
525 525
 		// if we couldn't open the file we return the old unencrypted size
526 526
 		if (!is_resource($stream)) {
527
-			$this->logger->error('Could not open ' . $path . '. Recalculation of unencrypted size aborted.');
527
+			$this->logger->error('Could not open '.$path.'. Recalculation of unencrypted size aborted.');
528 528
 			return $unencryptedSize;
529 529
 		}
530 530
 
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 		// next highest is end of chunks, one subtracted is last one
550 550
 		// we have to read the last chunk, we can't just calculate it (because of padding etc)
551 551
 
552
-		$lastChunkNr = ceil($size/ $blockSize)-1;
552
+		$lastChunkNr = ceil($size / $blockSize) - 1;
553 553
 		// calculate last chunk position
554 554
 		$lastChunkPos = ($lastChunkNr * $blockSize);
555 555
 		// try to fseek to the last chunk, if it fails we have to read the whole file
@@ -557,16 +557,16 @@  discard block
 block discarded – undo
557 557
 			$newUnencryptedSize += $lastChunkNr * $unencryptedBlockSize;
558 558
 		}
559 559
 
560
-		$lastChunkContentEncrypted='';
560
+		$lastChunkContentEncrypted = '';
561 561
 		$count = $blockSize;
562 562
 
563 563
 		while ($count > 0) {
564
-			$data=fread($stream, $blockSize);
565
-			$count=strlen($data);
564
+			$data = fread($stream, $blockSize);
565
+			$count = strlen($data);
566 566
 			$lastChunkContentEncrypted .= $data;
567
-			if(strlen($lastChunkContentEncrypted) > $blockSize) {
567
+			if (strlen($lastChunkContentEncrypted) > $blockSize) {
568 568
 				$newUnencryptedSize += $unencryptedBlockSize;
569
-				$lastChunkContentEncrypted=substr($lastChunkContentEncrypted, $blockSize);
569
+				$lastChunkContentEncrypted = substr($lastChunkContentEncrypted, $blockSize);
570 570
 			}
571 571
 		}
572 572
 
@@ -574,8 +574,8 @@  discard block
 block discarded – undo
574 574
 
575 575
 		// we have to decrypt the last chunk to get it actual size
576 576
 		$encryptionModule->begin($this->getFullPath($path), $this->uid, 'r', $header, []);
577
-		$decryptedLastChunk = $encryptionModule->decrypt($lastChunkContentEncrypted, $lastChunkNr . 'end');
578
-		$decryptedLastChunk .= $encryptionModule->end($this->getFullPath($path), $lastChunkNr . 'end');
577
+		$decryptedLastChunk = $encryptionModule->decrypt($lastChunkContentEncrypted, $lastChunkNr.'end');
578
+		$decryptedLastChunk .= $encryptionModule->end($this->getFullPath($path), $lastChunkNr.'end');
579 579
 
580 580
 		// calc the real file size with the size of the last chunk
581 581
 		$newUnencryptedSize += strlen($decryptedLastChunk);
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 		$cacheInformation = [
660 660
 			'encrypted' => $isEncrypted,
661 661
 		];
662
-		if($isEncrypted) {
662
+		if ($isEncrypted) {
663 663
 			$encryptedVersion = $sourceStorage->getCache()->get($sourceInternalPath)['encryptedVersion'];
664 664
 
665 665
 			// In case of a move operation from an unencrypted to an encrypted
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
 			// correct value would be "1". Thus we manually set the value to "1"
668 668
 			// for those cases.
669 669
 			// See also https://github.com/owncloud/core/issues/23078
670
-			if($encryptedVersion === 0 || !$keepEncryptionVersion) {
670
+			if ($encryptedVersion === 0 || !$keepEncryptionVersion) {
671 671
 				$encryptedVersion = 1;
672 672
 			}
673 673
 
@@ -703,9 +703,9 @@  discard block
 block discarded – undo
703 703
 			// remember that we try to create a version so that we can detect it during
704 704
 			// fopen($sourceInternalPath) and by-pass the encryption in order to
705 705
 			// create a 1:1 copy of the file
706
-			$this->arrayCache->set('encryption_copy_version_' . $sourceInternalPath, true);
706
+			$this->arrayCache->set('encryption_copy_version_'.$sourceInternalPath, true);
707 707
 			$result = $this->storage->copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath);
708
-			$this->arrayCache->remove('encryption_copy_version_' . $sourceInternalPath);
708
+			$this->arrayCache->remove('encryption_copy_version_'.$sourceInternalPath);
709 709
 			if ($result) {
710 710
 				$info = $this->getCache('', $sourceStorage)->get($sourceInternalPath);
711 711
 				// make sure that we update the unencrypted size for the version
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
 		$mount = $this->mountManager->findByStorageId($sourceStorage->getId());
726 726
 		if (count($mount) === 1) {
727 727
 			$mountPoint = $mount[0]->getMountPoint();
728
-			$source = $mountPoint . '/' . $sourceInternalPath;
728
+			$source = $mountPoint.'/'.$sourceInternalPath;
729 729
 			$target = $this->getFullPath($targetInternalPath);
730 730
 			$this->copyKeys($source, $target);
731 731
 		} else {
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
 			if (is_resource($dh)) {
739 739
 				while ($result and ($file = readdir($dh)) !== false) {
740 740
 					if (!Filesystem::isIgnoredDir($file)) {
741
-						$result &= $this->copyFromStorage($sourceStorage, $sourceInternalPath . '/' . $file, $targetInternalPath . '/' . $file, false, $isRename);
741
+						$result &= $this->copyFromStorage($sourceStorage, $sourceInternalPath.'/'.$file, $targetInternalPath.'/'.$file, false, $isRename);
742 742
 					}
743 743
 				}
744 744
 			}
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
 				fclose($target);
755 755
 				throw $e;
756 756
 			}
757
-			if($result) {
757
+			if ($result) {
758 758
 				if ($preserveMtime) {
759 759
 					$this->touch($targetInternalPath, $sourceStorage->filemtime($sourceInternalPath));
760 760
 				}
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
 				$this->getCache()->remove($targetInternalPath);
767 767
 			}
768 768
 		}
769
-		return (bool)$result;
769
+		return (bool) $result;
770 770
 
771 771
 	}
772 772
 
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
 	 * @return string full path including mount point
838 838
 	 */
839 839
 	protected function getFullPath($path) {
840
-		return Filesystem::normalizePath($this->mountPoint . '/' . $path);
840
+		return Filesystem::normalizePath($this->mountPoint.'/'.$path);
841 841
 	}
842 842
 
843 843
 	/**
@@ -893,7 +893,7 @@  discard block
 block discarded – undo
893 893
 				$header = substr($header, 0, $endAt + strlen(Util::HEADER_END));
894 894
 
895 895
 				// +1 to not start with an ':' which would result in empty element at the beginning
896
-				$exploded = explode(':', substr($header, strlen(Util::HEADER_START)+1));
896
+				$exploded = explode(':', substr($header, strlen(Util::HEADER_START) + 1));
897 897
 
898 898
 				$element = array_shift($exploded);
899 899
 				while ($element !== Util::HEADER_END) {
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
 			try {
957 957
 				$encryptionModule = $this->encryptionManager->getEncryptionModule($encryptionModuleId);
958 958
 			} catch (ModuleDoesNotExistsException $e) {
959
-				$this->logger->critical('Encryption module defined in "' . $path . '" not loaded!');
959
+				$this->logger->critical('Encryption module defined in "'.$path.'" not loaded!');
960 960
 				throw $e;
961 961
 			}
962 962
 		}
Please login to merge, or discard this patch.
lib/private/Archive/ZIP.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -33,21 +33,21 @@  discard block
 block discarded – undo
33 33
 use Icewind\Streams\CallbackWrapper;
34 34
 use OCP\ILogger;
35 35
 
36
-class ZIP extends Archive{
36
+class ZIP extends Archive {
37 37
 	/**
38 38
 	 * @var \ZipArchive zip
39 39
 	 */
40
-	private $zip=null;
40
+	private $zip = null;
41 41
 	private $path;
42 42
 
43 43
 	/**
44 44
 	 * @param string $source
45 45
 	 */
46 46
 	public function __construct($source) {
47
-		$this->path=$source;
48
-		$this->zip=new \ZipArchive();
49
-		if($this->zip->open($source, \ZipArchive::CREATE)) {
50
-		}else{
47
+		$this->path = $source;
48
+		$this->zip = new \ZipArchive();
49
+		if ($this->zip->open($source, \ZipArchive::CREATE)) {
50
+		} else {
51 51
 			\OCP\Util::writeLog('files_archive', 'Error while opening archive '.$source, ILogger::WARN);
52 52
 		}
53 53
 	}
@@ -65,14 +65,14 @@  discard block
 block discarded – undo
65 65
 	 * @param string $source either a local file or string data
66 66
 	 * @return bool
67 67
 	 */
68
-	public function addFile($path, $source='') {
69
-		if($source and $source[0]=='/' and file_exists($source)) {
70
-			$result=$this->zip->addFile($source, $path);
71
-		}else{
72
-			$result=$this->zip->addFromString($path, $source);
68
+	public function addFile($path, $source = '') {
69
+		if ($source and $source[0] == '/' and file_exists($source)) {
70
+			$result = $this->zip->addFile($source, $path);
71
+		} else {
72
+			$result = $this->zip->addFromString($path, $source);
73 73
 		}
74
-		if($result) {
75
-			$this->zip->close();//close and reopen to save the zip
74
+		if ($result) {
75
+			$this->zip->close(); //close and reopen to save the zip
76 76
 			$this->zip->open($this->path);
77 77
 		}
78 78
 		return $result;
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
 	 * @return boolean|null
85 85
 	 */
86 86
 	public function rename($source, $dest) {
87
-		$source=$this->stripPath($source);
88
-		$dest=$this->stripPath($dest);
87
+		$source = $this->stripPath($source);
88
+		$dest = $this->stripPath($dest);
89 89
 		$this->zip->renameName($source, $dest);
90 90
 	}
91 91
 	/**
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 * @return int
95 95
 	 */
96 96
 	public function filesize($path) {
97
-		$stat=$this->zip->statName($path);
97
+		$stat = $this->zip->statName($path);
98 98
 		return $stat['size'];
99 99
 	}
100 100
 	/**
@@ -111,13 +111,13 @@  discard block
 block discarded – undo
111 111
 	 * @return array
112 112
 	 */
113 113
 	public function getFolder($path) {
114
-		$files=$this->getFiles();
115
-		$folderContent=array();
116
-		$pathLength=strlen($path);
117
-		foreach($files as $file) {
118
-			if(substr($file, 0, $pathLength)==$path and $file!=$path) {
119
-				if(strrpos(substr($file, 0, -1), '/')<=$pathLength) {
120
-					$folderContent[]=substr($file, $pathLength);
114
+		$files = $this->getFiles();
115
+		$folderContent = array();
116
+		$pathLength = strlen($path);
117
+		foreach ($files as $file) {
118
+			if (substr($file, 0, $pathLength) == $path and $file != $path) {
119
+				if (strrpos(substr($file, 0, -1), '/') <= $pathLength) {
120
+					$folderContent[] = substr($file, $pathLength);
121 121
 				}
122 122
 			}
123 123
 		}
@@ -128,10 +128,10 @@  discard block
 block discarded – undo
128 128
 	 * @return array
129 129
 	 */
130 130
 	public function getFiles() {
131
-		$fileCount=$this->zip->numFiles;
132
-		$files=array();
133
-		for($i=0;$i<$fileCount;$i++) {
134
-			$files[]=$this->zip->getNameIndex($i);
131
+		$fileCount = $this->zip->numFiles;
132
+		$files = array();
133
+		for ($i = 0; $i < $fileCount; $i++) {
134
+			$files[] = $this->zip->getNameIndex($i);
135 135
 		}
136 136
 		return $files;
137 137
 	}
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 	 * @return bool
168 168
 	 */
169 169
 	public function fileExists($path) {
170
-		return ($this->zip->locateName($path)!==false) or ($this->zip->locateName($path.'/')!==false);
170
+		return ($this->zip->locateName($path) !== false) or ($this->zip->locateName($path.'/') !== false);
171 171
 	}
172 172
 	/**
173 173
 	 * remove a file or folder from the archive
@@ -175,9 +175,9 @@  discard block
 block discarded – undo
175 175
 	 * @return bool
176 176
 	 */
177 177
 	public function remove($path) {
178
-		if($this->fileExists($path.'/')) {
178
+		if ($this->fileExists($path.'/')) {
179 179
 			return $this->zip->deleteName($path.'/');
180
-		}else{
180
+		} else {
181 181
 			return $this->zip->deleteName($path);
182 182
 		}
183 183
 	}
@@ -188,23 +188,23 @@  discard block
 block discarded – undo
188 188
 	 * @return resource
189 189
 	 */
190 190
 	public function getStream($path, $mode) {
191
-		if($mode=='r' or $mode=='rb') {
191
+		if ($mode == 'r' or $mode == 'rb') {
192 192
 			return $this->zip->getStream($path);
193 193
 		} else {
194 194
 			//since we can't directly get a writable stream,
195 195
 			//make a temp copy of the file and put it back
196 196
 			//in the archive when the stream is closed
197
-			if(strrpos($path, '.')!==false) {
198
-				$ext=substr($path, strrpos($path, '.'));
199
-			}else{
200
-				$ext='';
197
+			if (strrpos($path, '.') !== false) {
198
+				$ext = substr($path, strrpos($path, '.'));
199
+			} else {
200
+				$ext = '';
201 201
 			}
202 202
 			$tmpFile = \OC::$server->getTempManager()->getTemporaryFile($ext);
203
-			if($this->fileExists($path)) {
203
+			if ($this->fileExists($path)) {
204 204
 				$this->extractFile($path, $tmpFile);
205 205
 			}
206 206
 			$handle = fopen($tmpFile, $mode);
207
-			return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) {
207
+			return CallbackWrapper::wrap($handle, null, null, function() use ($path, $tmpFile) {
208 208
 				$this->writeBack($tmpFile, $path);
209 209
 			});
210 210
 		}
@@ -223,9 +223,9 @@  discard block
 block discarded – undo
223 223
 	 * @return string
224 224
 	 */
225 225
 	private function stripPath($path) {
226
-		if(!$path || $path[0]=='/') {
226
+		if (!$path || $path[0] == '/') {
227 227
 			return substr($path, 1);
228
-		}else{
228
+		} else {
229 229
 			return $path;
230 230
 		}
231 231
 	}
Please login to merge, or discard this patch.
lib/private/Cache/File.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
 			$rootView = new View();
54 54
 			$user = \OC::$server->getUserSession()->getUser();
55 55
 			Filesystem::initMountPoints($user->getUID());
56
-			if (!$rootView->file_exists('/' . $user->getUID() . '/cache')) {
57
-				$rootView->mkdir('/' . $user->getUID() . '/cache');
56
+			if (!$rootView->file_exists('/'.$user->getUID().'/cache')) {
57
+				$rootView->mkdir('/'.$user->getUID().'/cache');
58 58
 			}
59
-			$this->storage = new View('/' . $user->getUID() . '/cache');
59
+			$this->storage = new View('/'.$user->getUID().'/cache');
60 60
 			return $this->storage;
61 61
 		} else {
62 62
 			\OCP\Util::writeLog('core', 'Can\'t get cache storage, user not logged in', ILogger::ERROR);
@@ -106,12 +106,12 @@  discard block
 block discarded – undo
106 106
 		// unique id to avoid chunk collision, just in case
107 107
 		$uniqueId = \OC::$server->getSecureRandom()->generate(
108 108
 			16,
109
-			ISecureRandom::CHAR_DIGITS . ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_UPPER
109
+			ISecureRandom::CHAR_DIGITS.ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_UPPER
110 110
 		);
111 111
 
112 112
 		// use part file to prevent hasKey() to find the key
113 113
 		// while it is being written
114
-		$keyPart = $key . '.' . $uniqueId . '.part';
114
+		$keyPart = $key.'.'.$uniqueId.'.part';
115 115
 		if ($storage and $storage->file_put_contents($keyPart, $value)) {
116 116
 			if ($ttl === 0) {
117 117
 				$ttl = 86400; // 60*60*24
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 			if (is_resource($dh)) {
161 161
 				while (($file = readdir($dh)) !== false) {
162 162
 					if ($file != '.' and $file != '..' and ($prefix === '' || strpos($file, $prefix) === 0)) {
163
-						$storage->unlink('/' . $file);
163
+						$storage->unlink('/'.$file);
164 164
 					}
165 165
 				}
166 166
 			}
@@ -185,17 +185,17 @@  discard block
 block discarded – undo
185 185
 			while (($file = readdir($dh)) !== false) {
186 186
 				if ($file != '.' and $file != '..') {
187 187
 					try {
188
-						$mtime = $storage->filemtime('/' . $file);
188
+						$mtime = $storage->filemtime('/'.$file);
189 189
 						if ($mtime < $now) {
190
-							$storage->unlink('/' . $file);
190
+							$storage->unlink('/'.$file);
191 191
 						}
192 192
 					} catch (\OCP\Lock\LockedException $e) {
193 193
 						// ignore locked chunks
194
-						\OC::$server->getLogger()->debug('Could not cleanup locked chunk "' . $file . '"', array('app' => 'core'));
194
+						\OC::$server->getLogger()->debug('Could not cleanup locked chunk "'.$file.'"', array('app' => 'core'));
195 195
 					} catch (\OCP\Files\ForbiddenException $e) {
196
-						\OC::$server->getLogger()->debug('Could not cleanup forbidden chunk "' . $file . '"', array('app' => 'core'));
196
+						\OC::$server->getLogger()->debug('Could not cleanup forbidden chunk "'.$file.'"', array('app' => 'core'));
197 197
 					} catch (\OCP\Files\LockNotAcquiredException $e) {
198
-						\OC::$server->getLogger()->debug('Could not cleanup locked chunk "' . $file . '"', array('app' => 'core'));
198
+						\OC::$server->getLogger()->debug('Could not cleanup locked chunk "'.$file.'"', array('app' => 'core'));
199 199
 					}
200 200
 				}
201 201
 			}
Please login to merge, or discard this patch.
lib/public/ILogger.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -39,23 +39,23 @@
 block discarded – undo
39 39
 	/**
40 40
 	 * @since 14.0.0
41 41
 	 */
42
-	const DEBUG=0;
42
+	const DEBUG = 0;
43 43
 	/**
44 44
 	 * @since 14.0.0
45 45
 	 */
46
-	const INFO=1;
46
+	const INFO = 1;
47 47
 	/**
48 48
 	 * @since 14.0.0
49 49
 	 */
50
-	const WARN=2;
50
+	const WARN = 2;
51 51
 	/**
52 52
 	 * @since 14.0.0
53 53
 	 */
54
-	const ERROR=3;
54
+	const ERROR = 3;
55 55
 	/**
56 56
 	 * @since 14.0.0
57 57
 	 */
58
-	const FATAL=4;
58
+	const FATAL = 4;
59 59
 
60 60
 	/**
61 61
 	 * System is unusable.
Please login to merge, or discard this patch.