Completed
Pull Request — master (#9293)
by Blizzz
18:49
created
lib/private/Files/Storage/Local.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 			$this->realDataDir = $this->datadir;
67 67
 		} else {
68 68
 			$realPath = realpath($this->datadir) ?: $this->datadir;
69
-			$this->realDataDir = rtrim($realPath, '/') . '/';
69
+			$this->realDataDir = rtrim($realPath, '/').'/';
70 70
 		}
71 71
 		if (substr($this->datadir, -1) !== '/') {
72 72
 			$this->datadir .= '/';
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	}
79 79
 
80 80
 	public function getId() {
81
-		return 'local::' . $this->datadir;
81
+		return 'local::'.$this->datadir;
82 82
 	}
83 83
 
84 84
 	public function mkdir($path) {
@@ -236,17 +236,17 @@  discard block
 block discarded – undo
236 236
 		$dstParent = dirname($path2);
237 237
 
238 238
 		if (!$this->isUpdatable($srcParent)) {
239
-			\OCP\Util::writeLog('core', 'unable to rename, source directory is not writable : ' . $srcParent, ILogger::ERROR);
239
+			\OCP\Util::writeLog('core', 'unable to rename, source directory is not writable : '.$srcParent, ILogger::ERROR);
240 240
 			return false;
241 241
 		}
242 242
 
243 243
 		if (!$this->isUpdatable($dstParent)) {
244
-			\OCP\Util::writeLog('core', 'unable to rename, destination directory is not writable : ' . $dstParent, ILogger::ERROR);
244
+			\OCP\Util::writeLog('core', 'unable to rename, destination directory is not writable : '.$dstParent, ILogger::ERROR);
245 245
 			return false;
246 246
 		}
247 247
 
248 248
 		if (!$this->file_exists($path1)) {
249
-			\OCP\Util::writeLog('core', 'unable to rename, file does not exists : ' . $path1, ILogger::ERROR);
249
+			\OCP\Util::writeLog('core', 'unable to rename, file does not exists : '.$path1, ILogger::ERROR);
250 250
 			return false;
251 251
 		}
252 252
 
@@ -327,13 +327,13 @@  discard block
 block discarded – undo
327 327
 		foreach (scandir($physicalDir) as $item) {
328 328
 			if (\OC\Files\Filesystem::isIgnoredDir($item))
329 329
 				continue;
330
-			$physicalItem = $physicalDir . '/' . $item;
330
+			$physicalItem = $physicalDir.'/'.$item;
331 331
 
332 332
 			if (strstr(strtolower($item), strtolower($query)) !== false) {
333
-				$files[] = $dir . '/' . $item;
333
+				$files[] = $dir.'/'.$item;
334 334
 			}
335 335
 			if (is_dir($physicalItem)) {
336
-				$files = array_merge($files, $this->searchInDir($query, $dir . '/' . $item));
336
+				$files = array_merge($files, $this->searchInDir($query, $dir.'/'.$item));
337 337
 			}
338 338
 		}
339 339
 		return $files;
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 	 * @throws ForbiddenException
363 363
 	 */
364 364
 	public function getSourcePath($path) {
365
-		$fullPath = $this->datadir . $path;
365
+		$fullPath = $this->datadir.$path;
366 366
 		$currentPath = $path;
367 367
 		if ($this->allowSymlinks || $currentPath === '') {
368 368
 			return $fullPath;
@@ -374,10 +374,10 @@  discard block
 block discarded – undo
374 374
 			if ($currentPath === '' || $currentPath === '.') {
375 375
 				return $fullPath;
376 376
 			}
377
-			$realPath = realpath($this->datadir . $currentPath);
377
+			$realPath = realpath($this->datadir.$currentPath);
378 378
 		}
379 379
 		if ($realPath) {
380
-			$realPath = $realPath . '/';
380
+			$realPath = $realPath.'/';
381 381
 		}
382 382
 		if (substr($realPath, 0, $this->dataDirLength) === $this->realDataDir) {
383 383
 			return $fullPath;
@@ -404,9 +404,9 @@  discard block
 block discarded – undo
404 404
 		if ($this->is_file($path)) {
405 405
 			$stat = $this->stat($path);
406 406
 			return md5(
407
-				$stat['mtime'] .
408
-				$stat['ino'] .
409
-				$stat['dev'] .
407
+				$stat['mtime'].
408
+				$stat['ino'].
409
+				$stat['dev'].
410 410
 				$stat['size']
411 411
 			);
412 412
 		} else {
Please login to merge, or discard this patch.
lib/private/Files/Storage/DAV.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 				if (is_string($params['secure'])) {
104 104
 					$this->secure = ($params['secure'] === 'true');
105 105
 				} else {
106
-					$this->secure = (bool)$params['secure'];
106
+					$this->secure = (bool) $params['secure'];
107 107
 				}
108 108
 			} else {
109 109
 				$this->secure = false;
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
 				}
121 121
 			}
122 122
 			$this->root = $params['root'] ?? '/';
123
-			$this->root = '/' . ltrim($this->root, '/');
124
-			$this->root = rtrim($this->root, '/') . '/';
123
+			$this->root = '/'.ltrim($this->root, '/');
124
+			$this->root = rtrim($this->root, '/').'/';
125 125
 		} else {
126 126
 			throw new \Exception('Invalid webdav storage configuration');
127 127
 		}
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 
164 164
 	/** {@inheritdoc} */
165 165
 	public function getId() {
166
-		return 'webdav::' . $this->user . '@' . $this->host . '/' . $this->root;
166
+		return 'webdav::'.$this->user.'@'.$this->host.'/'.$this->root;
167 167
 	}
168 168
 
169 169
 	/** {@inheritdoc} */
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 		if ($this->secure) {
173 173
 			$baseUri .= 's';
174 174
 		}
175
-		$baseUri .= '://' . $this->host . $this->root;
175
+		$baseUri .= '://'.$this->host.$this->root;
176 176
 		return $baseUri;
177 177
 	}
178 178
 
@@ -193,8 +193,8 @@  discard block
 block discarded – undo
193 193
 		$path = $this->cleanPath($path);
194 194
 		// FIXME: some WebDAV impl return 403 when trying to DELETE
195 195
 		// a non-empty folder
196
-		$result = $this->simpleResponse('DELETE', $path . '/', null, 204);
197
-		$this->statCache->clear($path . '/');
196
+		$result = $this->simpleResponse('DELETE', $path.'/', null, 204);
197
+		$this->statCache->clear($path.'/');
198 198
 		$this->statCache->remove($path);
199 199
 		return $result;
200 200
 	}
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 				$this->statCache->set($path, $response);
270 270
 			} catch (ClientHttpException $e) {
271 271
 				if ($e->getHttpStatus() === 404) {
272
-					$this->statCache->clear($path . '/');
272
+					$this->statCache->clear($path.'/');
273 273
 					$this->statCache->set($path, false);
274 274
 					return false;
275 275
 				}
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 		$this->init();
327 327
 		$path = $this->cleanPath($path);
328 328
 		$result = $this->simpleResponse('DELETE', $path, null, 204);
329
-		$this->statCache->clear($path . '/');
329
+		$this->statCache->clear($path.'/');
330 330
 		$this->statCache->remove($path);
331 331
 		return $result;
332 332
 	}
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 				try {
342 342
 					$response = $this->httpClientService
343 343
 						->newClient()
344
-						->get($this->createBaseUri() . $this->encodePath($path), [
344
+						->get($this->createBaseUri().$this->encodePath($path), [
345 345
 							'auth' => [$this->user, $this->password],
346 346
 							'stream' => true
347 347
 						]);
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 					if ($response->getStatusCode() === Http::STATUS_LOCKED) {
359 359
 						throw new \OCP\Lock\LockedException($path);
360 360
 					} else {
361
-						Util::writeLog("webdav client", 'Guzzle get returned status code ' . $response->getStatusCode(), ILogger::ERROR);
361
+						Util::writeLog("webdav client", 'Guzzle get returned status code '.$response->getStatusCode(), ILogger::ERROR);
362 362
 					}
363 363
 				}
364 364
 
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 					$tmpFile = $tempManager->getTemporaryFile($ext);
399 399
 				}
400 400
 				$handle = fopen($tmpFile, $mode);
401
-				return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) {
401
+				return CallbackWrapper::wrap($handle, null, null, function() use ($path, $tmpFile) {
402 402
 					$this->writeBack($tmpFile, $path);
403 403
 				});
404 404
 		}
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
 				return FileInfo::SPACE_UNKNOWN;
424 424
 			}
425 425
 			if (isset($response['{DAV:}quota-available-bytes'])) {
426
-				return (int)$response['{DAV:}quota-available-bytes'];
426
+				return (int) $response['{DAV:}quota-available-bytes'];
427 427
 			} else {
428 428
 				return FileInfo::SPACE_UNKNOWN;
429 429
 			}
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 
500 500
 		$this->httpClientService
501 501
 			->newClient()
502
-			->put($this->createBaseUri() . $this->encodePath($target), [
502
+			->put($this->createBaseUri().$this->encodePath($target), [
503 503
 				'body' => $source,
504 504
 				'auth' => [$this->user, $this->password]
505 505
 			]);
@@ -516,18 +516,18 @@  discard block
 block discarded – undo
516 516
 			// overwrite directory ?
517 517
 			if ($this->is_dir($path2)) {
518 518
 				// needs trailing slash in destination
519
-				$path2 = rtrim($path2, '/') . '/';
519
+				$path2 = rtrim($path2, '/').'/';
520 520
 			}
521 521
 			$this->client->request(
522 522
 				'MOVE',
523 523
 				$this->encodePath($path1),
524 524
 				null,
525 525
 				[
526
-					'Destination' => $this->createBaseUri() . $this->encodePath($path2),
526
+					'Destination' => $this->createBaseUri().$this->encodePath($path2),
527 527
 				]
528 528
 			);
529
-			$this->statCache->clear($path1 . '/');
530
-			$this->statCache->clear($path2 . '/');
529
+			$this->statCache->clear($path1.'/');
530
+			$this->statCache->clear($path2.'/');
531 531
 			$this->statCache->set($path1, false);
532 532
 			$this->statCache->set($path2, true);
533 533
 			$this->removeCachedFile($path1);
@@ -548,17 +548,17 @@  discard block
 block discarded – undo
548 548
 			// overwrite directory ?
549 549
 			if ($this->is_dir($path2)) {
550 550
 				// needs trailing slash in destination
551
-				$path2 = rtrim($path2, '/') . '/';
551
+				$path2 = rtrim($path2, '/').'/';
552 552
 			}
553 553
 			$this->client->request(
554 554
 				'COPY',
555 555
 				$this->encodePath($path1),
556 556
 				null,
557 557
 				[
558
-					'Destination' => $this->createBaseUri() . $this->encodePath($path2),
558
+					'Destination' => $this->createBaseUri().$this->encodePath($path2),
559 559
 				]
560 560
 			);
561
-			$this->statCache->clear($path2 . '/');
561
+			$this->statCache->clear($path2.'/');
562 562
 			$this->statCache->set($path2, true);
563 563
 			$this->removeCachedFile($path2);
564 564
 			return true;
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 			}
578 578
 			return [
579 579
 				'mtime' => strtotime($response['{DAV:}getlastmodified']),
580
-				'size' => (int)isset($response['{DAV:}getcontentlength']) ? $response['{DAV:}getcontentlength'] : 0,
580
+				'size' => (int) isset($response['{DAV:}getcontentlength']) ? $response['{DAV:}getcontentlength'] : 0,
581 581
 			];
582 582
 		} catch (\Exception $e) {
583 583
 			$this->convertException($e, $path);
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 			return $response['statusCode'] == $expected;
660 660
 		} catch (ClientHttpException $e) {
661 661
 			if ($e->getHttpStatus() === 404 && $method === 'DELETE') {
662
-				$this->statCache->clear($path . '/');
662
+				$this->statCache->clear($path.'/');
663 663
 				$this->statCache->set($path, false);
664 664
 				return false;
665 665
 			}
@@ -680,22 +680,22 @@  discard block
 block discarded – undo
680 680
 
681 681
 	/** {@inheritdoc} */
682 682
 	public function isUpdatable($path) {
683
-		return (bool)($this->getPermissions($path) & Constants::PERMISSION_UPDATE);
683
+		return (bool) ($this->getPermissions($path) & Constants::PERMISSION_UPDATE);
684 684
 	}
685 685
 
686 686
 	/** {@inheritdoc} */
687 687
 	public function isCreatable($path) {
688
-		return (bool)($this->getPermissions($path) & Constants::PERMISSION_CREATE);
688
+		return (bool) ($this->getPermissions($path) & Constants::PERMISSION_CREATE);
689 689
 	}
690 690
 
691 691
 	/** {@inheritdoc} */
692 692
 	public function isSharable($path) {
693
-		return (bool)($this->getPermissions($path) & Constants::PERMISSION_SHARE);
693
+		return (bool) ($this->getPermissions($path) & Constants::PERMISSION_SHARE);
694 694
 	}
695 695
 
696 696
 	/** {@inheritdoc} */
697 697
 	public function isDeletable($path) {
698
-		return (bool)($this->getPermissions($path) & Constants::PERMISSION_DELETE);
698
+		return (bool) ($this->getPermissions($path) & Constants::PERMISSION_DELETE);
699 699
 	}
700 700
 
701 701
 	/** {@inheritdoc} */
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
 				if (!empty($etag) && $cachedData['etag'] !== $etag) {
785 785
 					return true;
786 786
 				} else if (isset($response['{http://open-collaboration-services.org/ns}share-permissions'])) {
787
-					$sharePermissions = (int)$response['{http://open-collaboration-services.org/ns}share-permissions'];
787
+					$sharePermissions = (int) $response['{http://open-collaboration-services.org/ns}share-permissions'];
788 788
 					return $sharePermissions !== $cachedData['permissions'];
789 789
 				} else if (isset($response['{http://owncloud.org/ns}permissions'])) {
790 790
 					$permissions = $this->parsePermissions($response['{http://owncloud.org/ns}permissions']);
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
 			if ($e->getHttpStatus() === 405) {
801 801
 				if ($path === '') {
802 802
 					// if root is gone it means the storage is not available
803
-					throw new StorageNotAvailableException(get_class($e) . ': ' . $e->getMessage());
803
+					throw new StorageNotAvailableException(get_class($e).': '.$e->getMessage());
804 804
 				}
805 805
 				return false;
806 806
 			}
@@ -834,19 +834,19 @@  discard block
 block discarded – undo
834 834
 			}
835 835
 			if ($e->getHttpStatus() === Http::STATUS_UNAUTHORIZED) {
836 836
 				// either password was changed or was invalid all along
837
-				throw new StorageInvalidException(get_class($e) . ': ' . $e->getMessage());
837
+				throw new StorageInvalidException(get_class($e).': '.$e->getMessage());
838 838
 			} else if ($e->getHttpStatus() === Http::STATUS_METHOD_NOT_ALLOWED) {
839 839
 				// ignore exception for MethodNotAllowed, false will be returned
840 840
 				return;
841 841
 			}
842
-			throw new StorageNotAvailableException(get_class($e) . ': ' . $e->getMessage());
842
+			throw new StorageNotAvailableException(get_class($e).': '.$e->getMessage());
843 843
 		} else if ($e instanceof ClientException) {
844 844
 			// connection timeout or refused, server could be temporarily down
845
-			throw new StorageNotAvailableException(get_class($e) . ': ' . $e->getMessage());
845
+			throw new StorageNotAvailableException(get_class($e).': '.$e->getMessage());
846 846
 		} else if ($e instanceof \InvalidArgumentException) {
847 847
 			// parse error because the server returned HTML instead of XML,
848 848
 			// possibly temporarily down
849
-			throw new StorageNotAvailableException(get_class($e) . ': ' . $e->getMessage());
849
+			throw new StorageNotAvailableException(get_class($e).': '.$e->getMessage());
850 850
 		} else if (($e instanceof StorageNotAvailableException) || ($e instanceof StorageInvalidException)) {
851 851
 			// rethrow
852 852
 			throw $e;
Please login to merge, or discard this patch.
lib/private/Files/Storage/Common.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 			$this->mkdir($path2);
220 220
 			while ($file = readdir($dir)) {
221 221
 				if (!Filesystem::isIgnoredDir($file)) {
222
-					if (!$this->copy($path1 . '/' . $file, $path2 . '/' . $file)) {
222
+					if (!$this->copy($path1.'/'.$file, $path2.'/'.$file)) {
223 223
 						return false;
224 224
 					}
225 225
 				}
@@ -273,12 +273,12 @@  discard block
 block discarded – undo
273 273
 		if (is_resource($dh)) {
274 274
 			while (($file = readdir($dh)) !== false) {
275 275
 				if (!\OC\Files\Filesystem::isIgnoredDir($file)) {
276
-					if ($this->is_dir($path . '/' . $file)) {
277
-						mkdir($target . '/' . $file);
278
-						$this->addLocalFolder($path . '/' . $file, $target . '/' . $file);
276
+					if ($this->is_dir($path.'/'.$file)) {
277
+						mkdir($target.'/'.$file);
278
+						$this->addLocalFolder($path.'/'.$file, $target.'/'.$file);
279 279
 					} else {
280
-						$tmp = $this->toTmpFile($path . '/' . $file);
281
-						rename($tmp, $target . '/' . $file);
280
+						$tmp = $this->toTmpFile($path.'/'.$file);
281
+						rename($tmp, $target.'/'.$file);
282 282
 					}
283 283
 				}
284 284
 			}
@@ -297,10 +297,10 @@  discard block
 block discarded – undo
297 297
 			while (($item = readdir($dh)) !== false) {
298 298
 				if (\OC\Files\Filesystem::isIgnoredDir($item)) continue;
299 299
 				if (strstr(strtolower($item), strtolower($query)) !== false) {
300
-					$files[] = $dir . '/' . $item;
300
+					$files[] = $dir.'/'.$item;
301 301
 				}
302
-				if ($this->is_dir($dir . '/' . $item)) {
303
-					$files = array_merge($files, $this->searchInDir($query, $dir . '/' . $item));
302
+				if ($this->is_dir($dir.'/'.$item)) {
303
+					$files = array_merge($files, $this->searchInDir($query, $dir.'/'.$item));
304 304
 				}
305 305
 			}
306 306
 		}
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 		if (!isset($this->watcher)) {
352 352
 			$this->watcher = new Watcher($storage);
353 353
 			$globalPolicy = \OC::$server->getConfig()->getSystemValue('filesystem_check_changes', Watcher::CHECK_NEVER);
354
-			$this->watcher->setPolicy((int)$this->getMountOption('filesystem_check_changes', $globalPolicy));
354
+			$this->watcher->setPolicy((int) $this->getMountOption('filesystem_check_changes', $globalPolicy));
355 355
 		}
356 356
 		return $this->watcher;
357 357
 	}
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
 	 */
426 426
 	public function cleanPath($path) {
427 427
 		if (strlen($path) == 0 or $path[0] != '/') {
428
-			$path = '/' . $path;
428
+			$path = '/'.$path;
429 429
 		}
430 430
 
431 431
 		$output = array();
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 			\OC::$server->getLogger()->info("External storage not available: stat() failed");
454 454
 			return false;
455 455
 		} catch (\Exception $e) {
456
-			\OC::$server->getLogger()->info("External storage not available: " . $e->getMessage());
456
+			\OC::$server->getLogger()->info("External storage not available: ".$e->getMessage());
457 457
 			\OC::$server->getLogger()->logException($e, ['level' => ILogger::DEBUG]);
458 458
 			return false;
459 459
 		}
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
 			if (is_resource($dh)) {
605 605
 				while ($result and ($file = readdir($dh)) !== false) {
606 606
 					if (!Filesystem::isIgnoredDir($file)) {
607
-						$result &= $this->copyFromStorage($sourceStorage, $sourceInternalPath . '/' . $file, $targetInternalPath . '/' . $file);
607
+						$result &= $this->copyFromStorage($sourceStorage, $sourceInternalPath.'/'.$file, $targetInternalPath.'/'.$file);
608 608
 					}
609 609
 				}
610 610
 			}
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
 				$this->getCache()->remove($targetInternalPath);
631 631
 			}
632 632
 		}
633
-		return (bool)$result;
633
+		return (bool) $result;
634 634
 	}
635 635
 
636 636
 	/**
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
 			);
711 711
 		}
712 712
 		try {
713
-			$provider->acquireLock('files/' . md5($this->getId() . '::' . trim($path, '/')), $type);
713
+			$provider->acquireLock('files/'.md5($this->getId().'::'.trim($path, '/')), $type);
714 714
 		} catch (LockedException $e) {
715 715
 			if ($logger) {
716 716
 				$logger->logException($e);
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
 			);
743 743
 		}
744 744
 		try {
745
-			$provider->releaseLock('files/' . md5($this->getId() . '::' . trim($path, '/')), $type);
745
+			$provider->releaseLock('files/'.md5($this->getId().'::'.trim($path, '/')), $type);
746 746
 		} catch (LockedException $e) {
747 747
 			if ($logger) {
748 748
 				$logger->logException($e);
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
 			);
775 775
 		}
776 776
 		try {
777
-			$provider->changeLock('files/' . md5($this->getId() . '::' . trim($path, '/')), $type);
777
+			$provider->changeLock('files/'.md5($this->getId().'::'.trim($path, '/')), $type);
778 778
 		} catch (LockedException $e) {
779 779
 			if ($logger) {
780 780
 				$logger->logException($e);
Please login to merge, or discard this patch.
lib/private/Files/Cache/Scanner.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 		}
329 329
 		if ($lock) {
330 330
 			if ($this->storage->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) {
331
-				$this->storage->acquireLock('scanner::' . $path, ILockingProvider::LOCK_EXCLUSIVE, $this->lockingProvider);
331
+				$this->storage->acquireLock('scanner::'.$path, ILockingProvider::LOCK_EXCLUSIVE, $this->lockingProvider);
332 332
 				$this->storage->acquireLock($path, ILockingProvider::LOCK_SHARED, $this->lockingProvider);
333 333
 			}
334 334
 		}
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 		if ($lock) {
341 341
 			if ($this->storage->instanceOfStorage('\OCP\Files\Storage\ILockingStorage')) {
342 342
 				$this->storage->releaseLock($path, ILockingProvider::LOCK_SHARED, $this->lockingProvider);
343
-				$this->storage->releaseLock('scanner::' . $path, ILockingProvider::LOCK_EXCLUSIVE, $this->lockingProvider);
343
+				$this->storage->releaseLock('scanner::'.$path, ILockingProvider::LOCK_EXCLUSIVE, $this->lockingProvider);
344 344
 			}
345 345
 		}
346 346
 		return $data;
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 		$exceptionOccurred = false;
430 430
 		$childQueue = [];
431 431
 		foreach ($newChildren as $file) {
432
-			$child = $path ? $path . '/' . $file : $file;
432
+			$child = $path ? $path.'/'.$file : $file;
433 433
 			try {
434 434
 				$existingData = isset($existingChildren[$file]) ? $existingChildren[$file] : null;
435 435
 				$data = $this->scanFile($child, $reuse, $folderId, $existingData, $lock);
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 					\OC::$server->getDatabaseConnection()->beginTransaction();
455 455
 				}
456 456
 				\OC::$server->getLogger()->logException($ex, [
457
-					'message' => 'Exception while scanning file "' . $child . '"',
457
+					'message' => 'Exception while scanning file "'.$child.'"',
458 458
 					'level' => ILogger::DEBUG,
459 459
 					'app' => 'core',
460 460
 				]);
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 		}
469 469
 		$removedChildren = \array_diff(array_keys($existingChildren), $newChildren);
470 470
 		foreach ($removedChildren as $childName) {
471
-			$child = $path ? $path . '/' . $childName : $childName;
471
+			$child = $path ? $path.'/'.$childName : $childName;
472 472
 			$this->removeFromCache($child);
473 473
 		}
474 474
 		if ($this->useTransactions) {
@@ -508,13 +508,13 @@  discard block
 block discarded – undo
508 508
 	 */
509 509
 	public function backgroundScan() {
510 510
 		if (!$this->cache->inCache('')) {
511
-			$this->runBackgroundScanJob(function () {
511
+			$this->runBackgroundScanJob(function() {
512 512
 				$this->scan('', self::SCAN_RECURSIVE, self::REUSE_ETAG);
513 513
 			}, '');
514 514
 		} else {
515 515
 			$lastPath = null;
516 516
 			while (($path = $this->cache->getIncomplete()) !== false && $path !== $lastPath) {
517
-				$this->runBackgroundScanJob(function () use ($path) {
517
+				$this->runBackgroundScanJob(function() use ($path) {
518 518
 					$this->scan($path, self::SCAN_RECURSIVE_INCOMPLETE, self::REUSE_ETAG | self::REUSE_SIZE);
519 519
 				}, $path);
520 520
 				// FIXME: this won't proceed with the next item, needs revamping of getIncomplete()
Please login to merge, or discard this patch.
lib/private/Log/LogFactory.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	public function getCustomLogger(string $path):ILogger {
64 64
 		$systemConfig = null;
65 65
 		$iconfig = $this->c->getConfig();
66
-		if($iconfig instanceof AllConfig) {
66
+		if ($iconfig instanceof AllConfig) {
67 67
 			// Log is bound to SystemConfig, but fetches it from \OC::$server if not supplied
68 68
 			$systemConfig = $iconfig->getSystemConfig();
69 69
 		}
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	protected function buildLogFile(string $logFile = ''):File {
75 75
 		$config = $this->c->getConfig();
76 76
 		$defaultLogFile = $config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').'/nextcloud.log';
77
-		if($logFile === '') {
77
+		if ($logFile === '') {
78 78
 			$logFile = $config->getSystemValue('logfile', $defaultLogFile);
79 79
 		}
80 80
 		$fallback = $defaultLogFile !== $logFile ? $defaultLogFile : '';
Please login to merge, or discard this patch.
lib/private/Share/Share.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 					'collectionOf' => $collectionOf,
85 85
 					'supportedFileExtensions' => $supportedFileExtensions
86 86
 				);
87
-				if(count(self::$backendTypes) === 1) {
87
+				if (count(self::$backendTypes) === 1) {
88 88
 					Util::addScript('core', 'merged-share-backend');
89 89
 					\OC_Util::addStyle('core', 'share');
90 90
 				}
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
 		$select = self::createSelectStatement(self::FORMAT_NONE, $fileDependent);
157 157
 
158
-		$where .= ' `' . $column . '` = ? AND `item_type` = ? ';
158
+		$where .= ' `'.$column.'` = ? AND `item_type` = ? ';
159 159
 		$arguments = array($itemSource, $itemType);
160 160
 		// for link shares $user === null
161 161
 		if ($user !== null) {
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 			$arguments[] = $owner;
174 174
 		}
175 175
 
176
-		$query = \OC_DB::prepare('SELECT ' . $select . ' FROM `*PREFIX*share` '. $fileDependentWhere . $where);
176
+		$query = \OC_DB::prepare('SELECT '.$select.' FROM `*PREFIX*share` '.$fileDependentWhere.$where);
177 177
 
178 178
 		$result = \OC_DB::executeAudited($query, $arguments);
179 179
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 			if ($fileDependent && !self::isFileReachable($row['path'], $row['storage_id'])) {
182 182
 				continue;
183 183
 			}
184
-			if ($fileDependent && (int)$row['file_parent'] === -1) {
184
+			if ($fileDependent && (int) $row['file_parent'] === -1) {
185 185
 				// if it is a mount point we need to get the path from the mount manager
186 186
 				$mountManager = \OC\Files\Filesystem::getMountManager();
187 187
 				$mountPoint = $mountManager->findByStorageId($row['storage_id']);
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 					$row['path'] = $path;
193 193
 				} else {
194 194
 					\OC::$server->getLogger()->warning(
195
-						'Could not resolve mount point for ' . $row['storage_id'],
195
+						'Could not resolve mount point for '.$row['storage_id'],
196 196
 						['app' => 'OCP\Share']
197 197
 					);
198 198
 				}
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 		}
202 202
 
203 203
 		//if didn't found a result than let's look for a group share.
204
-		if(empty($shares) && $user !== null) {
204
+		if (empty($shares) && $user !== null) {
205 205
 			$userObject = \OC::$server->getUserManager()->get($user);
206 206
 			$groups = [];
207 207
 			if ($userObject) {
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 			}
210 210
 
211 211
 			if (!empty($groups)) {
212
-				$where = $fileDependentWhere . ' WHERE `' . $column . '` = ? AND `item_type` = ? AND `share_with` in (?)';
212
+				$where = $fileDependentWhere.' WHERE `'.$column.'` = ? AND `item_type` = ? AND `share_with` in (?)';
213 213
 				$arguments = array($itemSource, $itemType, $groups);
214 214
 				$types = array(null, null, IQueryBuilder::PARAM_STR_ARRAY);
215 215
 
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 				// class isn't static anymore...
224 224
 				$conn = \OC::$server->getDatabaseConnection();
225 225
 				$result = $conn->executeQuery(
226
-					'SELECT ' . $select . ' FROM `*PREFIX*share` ' . $where,
226
+					'SELECT '.$select.' FROM `*PREFIX*share` '.$where,
227 227
 					$arguments,
228 228
 					$types
229 229
 				);
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 		$query = \OC_DB::prepare('SELECT * FROM `*PREFIX*share` WHERE `token` = ?', 1);
266 266
 		$result = $query->execute(array($token));
267 267
 		if ($result === false) {
268
-			\OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage() . ', token=' . $token, ILogger::ERROR);
268
+			\OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage().', token='.$token, ILogger::ERROR);
269 269
 		}
270 270
 		$row = $result->fetchRow();
271 271
 		if ($row === false) {
@@ -371,12 +371,12 @@  discard block
 block discarded – undo
371 371
 
372 372
 		//verify that we don't share a folder which already contains a share mount point
373 373
 		if ($itemType === 'folder') {
374
-			$path = '/' . $uidOwner . '/files' . \OC\Files\Filesystem::getPath($itemSource) . '/';
374
+			$path = '/'.$uidOwner.'/files'.\OC\Files\Filesystem::getPath($itemSource).'/';
375 375
 			$mountManager = \OC\Files\Filesystem::getMountManager();
376 376
 			$mounts = $mountManager->findIn($path);
377 377
 			foreach ($mounts as $mount) {
378 378
 				if ($mount->getStorage()->instanceOfStorage('\OCA\Files_Sharing\ISharedStorage')) {
379
-					$message = 'Sharing "' . $itemSourceName . '" failed, because it contains files shared with you!';
379
+					$message = 'Sharing "'.$itemSourceName.'" failed, because it contains files shared with you!';
380 380
 					\OCP\Util::writeLog('OCP\Share', $message, ILogger::DEBUG);
381 381
 					throw new \Exception($message);
382 382
 				}
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 
387 387
 		// single file shares should never have delete permissions
388 388
 		if ($itemType === 'file') {
389
-			$permissions = (int)$permissions & ~\OCP\Constants::PERMISSION_DELETE;
389
+			$permissions = (int) $permissions & ~\OCP\Constants::PERMISSION_DELETE;
390 390
 		}
391 391
 
392 392
 		//Validate expirationDate
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 					} else {
541 541
 						// reuse the already set password, but only if we change permissions
542 542
 						// otherwise the user disabled the password protection
543
-						if ($checkExists && (int)$permissions !== (int)$oldPermissions) {
543
+						if ($checkExists && (int) $permissions !== (int) $oldPermissions) {
544 544
 							$shareWith = $checkExists['share_with'];
545 545
 						}
546 546
 					}
@@ -612,10 +612,10 @@  discard block
 block discarded – undo
612 612
 				throw new \Exception($message_t);
613 613
 			}
614 614
 
615
-			$token = \OC::$server->getSecureRandom()->generate(self::TOKEN_LENGTH, \OCP\Security\ISecureRandom::CHAR_LOWER . \OCP\Security\ISecureRandom::CHAR_UPPER .
615
+			$token = \OC::$server->getSecureRandom()->generate(self::TOKEN_LENGTH, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_UPPER.
616 616
 				\OCP\Security\ISecureRandom::CHAR_DIGITS);
617 617
 
618
-			$shareWith = $user . '@' . $remote;
618
+			$shareWith = $user.'@'.$remote;
619 619
 			$shareId = self::put($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $permissions, null, $token, $itemSourceName);
620 620
 
621 621
 			$send = false;
@@ -666,12 +666,12 @@  discard block
 block discarded – undo
666 666
 		$currentUser = $owner ? $owner : \OC_User::getUser();
667 667
 		foreach ($items as $item) {
668 668
 			// delete the item with the expected share_type and owner
669
-			if ((int)$item['share_type'] === (int)$shareType && $item['uid_owner'] === $currentUser) {
669
+			if ((int) $item['share_type'] === (int) $shareType && $item['uid_owner'] === $currentUser) {
670 670
 				$toDelete = $item;
671 671
 				// if there is more then one result we don't have to delete the children
672 672
 				// but update their parent. For group shares the new parent should always be
673 673
 				// the original group share and not the db entry with the unique name
674
-			} else if ((int)$item['share_type'] === self::$shareTypeGroupUserUnique) {
674
+			} else if ((int) $item['share_type'] === self::$shareTypeGroupUserUnique) {
675 675
 				$newParent = $item['parent'];
676 676
 			} else {
677 677
 				$newParent = $item['id'];
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
 
704 704
 		$result = $query->execute(array($status, $itemType, $itemSource, $shareType, $recipient));
705 705
 
706
-		if($result === false) {
706
+		if ($result === false) {
707 707
 			\OCP\Util::writeLog('OCP\Share', 'Couldn\'t set send mail status', ILogger::ERROR);
708 708
 		}
709 709
 	}
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
 		if ($defaultExpireDateEnforced && $shareTime === null) {
730 730
 			$items = self::getItemShared($itemType, $itemSource);
731 731
 			$firstItem = reset($items);
732
-			$shareTime = (int)$firstItem['stime'];
732
+			$shareTime = (int) $firstItem['stime'];
733 733
 		}
734 734
 
735 735
 		if ($defaultExpireDateEnforced) {
@@ -737,9 +737,9 @@  discard block
 block discarded – undo
737 737
 			$maxDate = new \DateTime();
738 738
 			$maxDate->setTimestamp($shareTime);
739 739
 			$maxDays = \OC::$server->getConfig()->getAppValue('core', 'shareapi_expire_after_n_days', '7');
740
-			$maxDate->add(new \DateInterval('P' . $maxDays . 'D'));
740
+			$maxDate->add(new \DateInterval('P'.$maxDays.'D'));
741 741
 			if ($date > $maxDate) {
742
-				$warning = 'Cannot set expiration date. Shares cannot expire later than ' . $maxDays . ' after they have been shared';
742
+				$warning = 'Cannot set expiration date. Shares cannot expire later than '.$maxDays.' after they have been shared';
743 743
 				$warning_t = $l->t('Cannot set expiration date. Shares cannot expire later than %s after they have been shared', array($maxDays));
744 744
 				\OCP\Util::writeLog('OCP\Share', $warning, ILogger::WARN);
745 745
 				throw new \Exception($warning_t);
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 	 */
802 802
 	protected static function unshareItem(array $item, $newParent = null) {
803 803
 
804
-		$shareType = (int)$item['share_type'];
804
+		$shareType = (int) $item['share_type'];
805 805
 		$shareWith = null;
806 806
 		if ($shareType !== \OCP\Share::SHARE_TYPE_LINK) {
807 807
 			$shareWith = $item['share_with'];
@@ -817,7 +817,7 @@  discard block
 block discarded – undo
817 817
 			'itemParent'    => $item['parent'],
818 818
 			'uidOwner'      => $item['uid_owner'],
819 819
 		);
820
-		if($item['item_type'] === 'file' || $item['item_type'] === 'folder') {
820
+		if ($item['item_type'] === 'file' || $item['item_type'] === 'folder') {
821 821
 			$hookParams['fileSource'] = $item['file_source'];
822 822
 			$hookParams['fileTarget'] = $item['file_target'];
823 823
 		}
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
 		$deletedShares[] = $hookParams;
828 828
 		$hookParams['deletedShares'] = $deletedShares;
829 829
 		\OC_Hook::emit(\OCP\Share::class, 'post_unshare', $hookParams);
830
-		if ((int)$item['share_type'] === \OCP\Share::SHARE_TYPE_REMOTE && \OC::$server->getUserSession()->getUser()) {
830
+		if ((int) $item['share_type'] === \OCP\Share::SHARE_TYPE_REMOTE && \OC::$server->getUserSession()->getUser()) {
831 831
 			list(, $remote) = Helper::splitUserRemote($item['share_with']);
832 832
 			self::sendRemoteUnshare($remote, $item['id'], $item['token']);
833 833
 		}
@@ -988,7 +988,7 @@  discard block
 block discarded – undo
988 988
 		// Get filesystem root to add it to the file target and remove from the
989 989
 		// file source, match file_source with the file cache
990 990
 		if ($itemType == 'file' || $itemType == 'folder') {
991
-			if(!is_null($uidOwner)) {
991
+			if (!is_null($uidOwner)) {
992 992
 				$root = \OC\Files\Filesystem::getRoot();
993 993
 			} else {
994 994
 				$root = '';
@@ -1133,7 +1133,7 @@  discard block
 block discarded – undo
1133 1133
 		$result = $query->execute($queryArgs);
1134 1134
 		if ($result === false) {
1135 1135
 			\OCP\Util::writeLog('OCP\Share',
1136
-				\OC_DB::getErrorMessage() . ', select=' . $select . ' where=',
1136
+				\OC_DB::getErrorMessage().', select='.$select.' where=',
1137 1137
 				ILogger::ERROR);
1138 1138
 		}
1139 1139
 		$items = array();
@@ -1175,14 +1175,14 @@  discard block
 block discarded – undo
1175 1175
 						}
1176 1176
 						// Switch ids if sharing permission is granted on only
1177 1177
 						// one share to ensure correct parent is used if resharing
1178
-						if (~(int)$items[$id]['permissions'] & \OCP\Constants::PERMISSION_SHARE
1179
-							&& (int)$row['permissions'] & \OCP\Constants::PERMISSION_SHARE) {
1178
+						if (~(int) $items[$id]['permissions'] & \OCP\Constants::PERMISSION_SHARE
1179
+							&& (int) $row['permissions'] & \OCP\Constants::PERMISSION_SHARE) {
1180 1180
 							$items[$row['id']] = $items[$id];
1181 1181
 							$switchedItems[$id] = $row['id'];
1182 1182
 							unset($items[$id]);
1183 1183
 							$id = $row['id'];
1184 1184
 						}
1185
-						$items[$id]['permissions'] |= (int)$row['permissions'];
1185
+						$items[$id]['permissions'] |= (int) $row['permissions'];
1186 1186
 
1187 1187
 					}
1188 1188
 					continue;
@@ -1196,8 +1196,8 @@  discard block
 block discarded – undo
1196 1196
 					$query = \OC_DB::prepare('SELECT `file_target` FROM `*PREFIX*share` WHERE `id` = ?');
1197 1197
 					$parentResult = $query->execute(array($row['parent']));
1198 1198
 					if ($result === false) {
1199
-						\OCP\Util::writeLog('OCP\Share', 'Can\'t select parent: ' .
1200
-							\OC_DB::getErrorMessage() . ', select=' . $select . ' where=' . $where,
1199
+						\OCP\Util::writeLog('OCP\Share', 'Can\'t select parent: '.
1200
+							\OC_DB::getErrorMessage().', select='.$select.' where='.$where,
1201 1201
 							ILogger::ERROR);
1202 1202
 					} else {
1203 1203
 						$parentRow = $parentResult->fetchRow();
@@ -1207,7 +1207,7 @@  discard block
 block discarded – undo
1207 1207
 						$subPath = substr($row['path'], $pos);
1208 1208
 						$splitPath = explode('/', $subPath);
1209 1209
 						foreach (array_slice($splitPath, 2) as $pathPart) {
1210
-							$tmpPath = $tmpPath . '/' . $pathPart;
1210
+							$tmpPath = $tmpPath.'/'.$pathPart;
1211 1211
 						}
1212 1212
 						$row['path'] = $tmpPath;
1213 1213
 					}
@@ -1226,7 +1226,7 @@  discard block
 block discarded – undo
1226 1226
 				}
1227 1227
 			}
1228 1228
 
1229
-			if($checkExpireDate) {
1229
+			if ($checkExpireDate) {
1230 1230
 				if (self::expireItem($row)) {
1231 1231
 					continue;
1232 1232
 				}
@@ -1237,11 +1237,11 @@  discard block
 block discarded – undo
1237 1237
 			}
1238 1238
 			// Add display names to result
1239 1239
 			$row['share_with_displayname'] = $row['share_with'];
1240
-			if ( isset($row['share_with']) && $row['share_with'] != '' &&
1240
+			if (isset($row['share_with']) && $row['share_with'] != '' &&
1241 1241
 				$row['share_type'] === self::SHARE_TYPE_USER) {
1242 1242
 				$shareWithUser = \OC::$server->getUserManager()->get($row['share_with']);
1243 1243
 				$row['share_with_displayname'] = $shareWithUser === null ? $row['share_with'] : $shareWithUser->getDisplayName();
1244
-			} else if(isset($row['share_with']) && $row['share_with'] != '' &&
1244
+			} else if (isset($row['share_with']) && $row['share_with'] != '' &&
1245 1245
 				$row['share_type'] === self::SHARE_TYPE_REMOTE) {
1246 1246
 				$addressBookEntries = \OC::$server->getContactsManager()->search($row['share_with'], ['CLOUD']);
1247 1247
 				foreach ($addressBookEntries as $entry) {
@@ -1252,7 +1252,7 @@  discard block
 block discarded – undo
1252 1252
 					}
1253 1253
 				}
1254 1254
 			}
1255
-			if ( isset($row['uid_owner']) && $row['uid_owner'] != '') {
1255
+			if (isset($row['uid_owner']) && $row['uid_owner'] != '') {
1256 1256
 				$ownerUser = \OC::$server->getUserManager()->get($row['uid_owner']);
1257 1257
 				$row['displayname_owner'] = $ownerUser === null ? $row['uid_owner'] : $ownerUser->getDisplayName();
1258 1258
 			}
@@ -1401,7 +1401,7 @@  discard block
 block discarded – undo
1401 1401
 				// for file/folder shares we need to compare file_source, otherwise we compare item_source
1402 1402
 				// only group shares if they already point to the same target, otherwise the file where shared
1403 1403
 				// before grouping of shares was added. In this case we don't group them toi avoid confusions
1404
-				if (( $fileSharing && $item['file_source'] === $r['file_source'] && $item['file_target'] === $r['file_target']) ||
1404
+				if (($fileSharing && $item['file_source'] === $r['file_source'] && $item['file_target'] === $r['file_target']) ||
1405 1405
 					(!$fileSharing && $item['item_source'] === $r['item_source'] && $item['item_target'] === $r['item_target'])) {
1406 1406
 					// add the first item to the list of grouped shares
1407 1407
 					if (!isset($result[$key]['grouped'])) {
@@ -1447,7 +1447,7 @@  discard block
 block discarded – undo
1447 1447
 		$groupItemTarget = $itemTarget = $fileSource = $parent = 0;
1448 1448
 
1449 1449
 		$result = self::checkReshare($itemType, $itemSource, $shareType, $shareWith, $uidOwner, $permissions, $itemSourceName, $expirationDate);
1450
-		if(!empty($result)) {
1450
+		if (!empty($result)) {
1451 1451
 			$parent = $result['parent'];
1452 1452
 			$itemSource = $result['itemSource'];
1453 1453
 			$fileSource = $result['fileSource'];
@@ -1541,11 +1541,11 @@  discard block
 block discarded – undo
1541 1541
 				$itemTarget = $sourceExists['item_target'];
1542 1542
 
1543 1543
 				// for group shares we don't need a additional entry if the target is the same
1544
-				if($isGroupShare && $groupItemTarget === $itemTarget) {
1544
+				if ($isGroupShare && $groupItemTarget === $itemTarget) {
1545 1545
 					continue;
1546 1546
 				}
1547 1547
 
1548
-			} elseif(!$sourceExists && !$isGroupShare)  {
1548
+			} elseif (!$sourceExists && !$isGroupShare) {
1549 1549
 
1550 1550
 				$itemTarget = Helper::generateTarget($itemType, $itemSource, $userShareType, $user,
1551 1551
 					$uidOwner, $suggestedItemTarget, $parent);
@@ -1676,8 +1676,8 @@  discard block
 block discarded – undo
1676 1676
 
1677 1677
 		if ($checkReshare && $checkReshare['uid_owner'] !== \OC_User::getUser()) {
1678 1678
 			// Check if share permissions is granted
1679
-			if (self::isResharingAllowed() && (int)$checkReshare['permissions'] & \OCP\Constants::PERMISSION_SHARE) {
1680
-				if (~(int)$checkReshare['permissions'] & $permissions) {
1679
+			if (self::isResharingAllowed() && (int) $checkReshare['permissions'] & \OCP\Constants::PERMISSION_SHARE) {
1680
+				if (~(int) $checkReshare['permissions'] & $permissions) {
1681 1681
 					$message = 'Sharing %s failed, because the permissions exceed permissions granted to %s';
1682 1682
 					$message_t = $l->t('Sharing %s failed, because the permissions exceed permissions granted to %s', array($itemSourceName, $uidOwner));
1683 1683
 
@@ -1689,7 +1689,7 @@  discard block
 block discarded – undo
1689 1689
 
1690 1690
 					$result['expirationDate'] = $expirationDate;
1691 1691
 					// $checkReshare['expiration'] could be null and then is always less than any value
1692
-					if(isset($checkReshare['expiration']) && $checkReshare['expiration'] < $expirationDate) {
1692
+					if (isset($checkReshare['expiration']) && $checkReshare['expiration'] < $expirationDate) {
1693 1693
 						$result['expirationDate'] = $checkReshare['expiration'];
1694 1694
 					}
1695 1695
 
@@ -1781,7 +1781,7 @@  discard block
 block discarded – undo
1781 1781
 
1782 1782
 		$id = false;
1783 1783
 		if ($result) {
1784
-			$id =  \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*share');
1784
+			$id = \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*share');
1785 1785
 		}
1786 1786
 
1787 1787
 		return $id;
@@ -1809,8 +1809,8 @@  discard block
 block discarded – undo
1809 1809
 			return true;
1810 1810
 		}
1811 1811
 
1812
-		if ( \OC::$server->getSession()->exists('public_link_authenticated')
1813
-			&& \OC::$server->getSession()->get('public_link_authenticated') === (string)$linkItem['id'] ) {
1812
+		if (\OC::$server->getSession()->exists('public_link_authenticated')
1813
+			&& \OC::$server->getSession()->get('public_link_authenticated') === (string) $linkItem['id']) {
1814 1814
 			return true;
1815 1815
 		}
1816 1816
 
@@ -1912,7 +1912,7 @@  discard block
 block discarded – undo
1912 1912
 	 * @param array $parameters additional format parameters
1913 1913
 	 * @return array format result
1914 1914
 	 */
1915
-	private static function formatResult($items, $column, $backend, $format = self::FORMAT_NONE , $parameters = null) {
1915
+	private static function formatResult($items, $column, $backend, $format = self::FORMAT_NONE, $parameters = null) {
1916 1916
 		if ($format === self::FORMAT_NONE) {
1917 1917
 			return $items;
1918 1918
 		} else if ($format === self::FORMAT_STATUSES) {
@@ -1969,13 +1969,13 @@  discard block
 block discarded – undo
1969 1969
 		$try = 0;
1970 1970
 		$discoveryService = \OC::$server->query(\OCP\OCS\IDiscoveryService::class);
1971 1971
 		while ($result['success'] === false && $try < 2) {
1972
-			$federationEndpoints = $discoveryService->discover($protocol . $remoteDomain, 'FEDERATED_SHARING');
1972
+			$federationEndpoints = $discoveryService->discover($protocol.$remoteDomain, 'FEDERATED_SHARING');
1973 1973
 			$endpoint = isset($federationEndpoints['share']) ? $federationEndpoints['share'] : '/ocs/v2.php/cloud/shares';
1974 1974
 			$client = \OC::$server->getHTTPClientService()->newClient();
1975 1975
 
1976 1976
 			try {
1977 1977
 				$response = $client->post(
1978
-					$protocol . $remoteDomain . $endpoint . $urlSuffix . '?format=' . self::RESPONSE_FORMAT,
1978
+					$protocol.$remoteDomain.$endpoint.$urlSuffix.'?format='.self::RESPONSE_FORMAT,
1979 1979
 					[
1980 1980
 						'body' => $fields,
1981 1981
 						'connect_timeout' => 10,
@@ -2075,7 +2075,7 @@  discard block
 block discarded – undo
2075 2075
 	 * @return int
2076 2076
 	 */
2077 2077
 	public static function getExpireInterval() {
2078
-		return (int)\OC::$server->getConfig()->getAppValue('core', 'shareapi_expire_after_n_days', '7');
2078
+		return (int) \OC::$server->getConfig()->getAppValue('core', 'shareapi_expire_after_n_days', '7');
2079 2079
 	}
2080 2080
 
2081 2081
 	/**
Please login to merge, or discard this patch.
lib/private/AppFramework/DependencyInjection/DIContainer.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 * @param array $urlParams
83 83
 	 * @param ServerContainer|null $server
84 84
 	 */
85
-	public function __construct($appName, $urlParams = array(), ServerContainer $server = null){
85
+	public function __construct($appName, $urlParams = array(), ServerContainer $server = null) {
86 86
 		parent::__construct();
87 87
 		$this['AppName'] = $appName;
88 88
 		$this['urlParams'] = $urlParams;
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 		/**
103 103
 		 * Core services
104 104
 		 */
105
-		$this->registerService(IOutput::class, function($c){
105
+		$this->registerService(IOutput::class, function($c) {
106 106
 			return new Output($this->getServer()->getWebRoot());
107 107
 		});
108 108
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 			return $this->getServer()->getUserFolder();
111 111
 		});
112 112
 
113
-		$this->registerService(IAppData::class, function (SimpleContainer $c) {
113
+		$this->registerService(IAppData::class, function(SimpleContainer $c) {
114 114
 			return $this->getServer()->getAppDataDir($c->query('AppName'));
115 115
 		});
116 116
 
@@ -131,37 +131,37 @@  discard block
 block discarded – undo
131 131
 
132 132
 		$this->registerAlias(\OC\User\Session::class, \OCP\IUserSession::class);
133 133
 
134
-		$this->registerService(IServerContainer::class, function ($c) {
134
+		$this->registerService(IServerContainer::class, function($c) {
135 135
 			return $this->getServer();
136 136
 		});
137 137
 		$this->registerAlias('ServerContainer', IServerContainer::class);
138 138
 
139
-		$this->registerService(\OCP\WorkflowEngine\IManager::class, function ($c) {
139
+		$this->registerService(\OCP\WorkflowEngine\IManager::class, function($c) {
140 140
 			return $c->query(Manager::class);
141 141
 		});
142 142
 
143
-		$this->registerService(\OCP\AppFramework\IAppContainer::class, function ($c) {
143
+		$this->registerService(\OCP\AppFramework\IAppContainer::class, function($c) {
144 144
 			return $c;
145 145
 		});
146 146
 
147 147
 		// commonly used attributes
148
-		$this->registerService('UserId', function ($c) {
148
+		$this->registerService('UserId', function($c) {
149 149
 			return $c->query(IUserSession::class)->getSession()->get('user_id');
150 150
 		});
151 151
 
152
-		$this->registerService('WebRoot', function ($c) {
152
+		$this->registerService('WebRoot', function($c) {
153 153
 			return $c->query('ServerContainer')->getWebRoot();
154 154
 		});
155 155
 
156
-		$this->registerService('OC_Defaults', function ($c) {
156
+		$this->registerService('OC_Defaults', function($c) {
157 157
 			return $c->getServer()->getThemingDefaults();
158 158
 		});
159 159
 
160
-		$this->registerService(IManager::class, function ($c) {
160
+		$this->registerService(IManager::class, function($c) {
161 161
 			return $this->getServer()->getEncryptionManager();
162 162
 		});
163 163
 
164
-		$this->registerService(IConfig::class, function ($c) {
164
+		$this->registerService(IConfig::class, function($c) {
165 165
 			return $c->query(OC\GlobalScale\Config::class);
166 166
 		});
167 167
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 			return $c->query(Validator::class);
170 170
 		});
171 171
 
172
-		$this->registerService(\OC\Security\IdentityProof\Manager::class, function ($c) {
172
+		$this->registerService(\OC\Security\IdentityProof\Manager::class, function($c) {
173 173
 			return new \OC\Security\IdentityProof\Manager(
174 174
 				$this->getServer()->query(\OC\Files\AppData\Factory::class),
175 175
 				$this->getServer()->getCrypto(),
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 			);
178 178
 		});
179 179
 
180
-		$this->registerService('Protocol', function($c){
180
+		$this->registerService('Protocol', function($c) {
181 181
 			/** @var \OC\Server $server */
182 182
 			$server = $c->query('ServerContainer');
183 183
 			$protocol = $server->getRequest()->getHttpProtocol();
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 			);
226 226
 		});
227 227
 
228
-		$this->registerService(OC\AppFramework\Middleware\Security\PasswordConfirmationMiddleware::class, function ($c) use ($app) {
228
+		$this->registerService(OC\AppFramework\Middleware\Security\PasswordConfirmationMiddleware::class, function($c) use ($app) {
229 229
 			/** @var \OC\Server $server */
230 230
 			$server = $app->getServer();
231 231
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 			);
278 278
 		});
279 279
 
280
-		$this->registerService('TwoFactorMiddleware', function (SimpleContainer $c) use ($app) {
280
+		$this->registerService('TwoFactorMiddleware', function(SimpleContainer $c) use ($app) {
281 281
 			$twoFactorManager = $c->getServer()->getTwoFactorAuthManager();
282 282
 			$userSession = $app->getServer()->getUserSession();
283 283
 			$session = $app->getServer()->getSession();
@@ -287,13 +287,13 @@  discard block
 block discarded – undo
287 287
 			return new TwoFactorMiddleware($twoFactorManager, $userSession, $session, $urlGenerator, $reflector, $request);
288 288
 		});
289 289
 
290
-		$this->registerService('OCSMiddleware', function (SimpleContainer $c) {
290
+		$this->registerService('OCSMiddleware', function(SimpleContainer $c) {
291 291
 			return new OCSMiddleware(
292 292
 				$c['Request']
293 293
 			);
294 294
 		});
295 295
 
296
-		$this->registerService(OC\AppFramework\Middleware\Security\SameSiteCookieMiddleware::class, function (SimpleContainer $c) {
296
+		$this->registerService(OC\AppFramework\Middleware\Security\SameSiteCookieMiddleware::class, function(SimpleContainer $c) {
297 297
 			return new OC\AppFramework\Middleware\Security\SameSiteCookieMiddleware(
298 298
 				$c['Request'],
299 299
 				$c['ControllerMethodReflector']
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 			$dispatcher->registerMiddleware($c['BruteForceMiddleware']);
313 313
 			$dispatcher->registerMiddleware($c['RateLimitingMiddleware']);
314 314
 
315
-			foreach($middleWares as $middleWare) {
315
+			foreach ($middleWares as $middleWare) {
316 316
 				$dispatcher->registerMiddleware($c[$middleWare]);
317 317
 			}
318 318
 
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 	 * @return mixed
375 375
 	 */
376 376
 	public function log($message, $level) {
377
-		switch($level){
377
+		switch ($level) {
378 378
 			case 'debug':
379 379
 				$level = ILogger::DEBUG;
380 380
 				break;
@@ -440,12 +440,12 @@  discard block
 block discarded – undo
440 440
 				return parent::query($name);
441 441
 			} else if ($this['AppName'] === 'core' && strpos($name, 'OC\\Core\\') === 0) {
442 442
 				return parent::query($name);
443
-			} else if (strpos($name, \OC\AppFramework\App::buildAppNamespace($this['AppName']) . '\\') === 0) {
443
+			} else if (strpos($name, \OC\AppFramework\App::buildAppNamespace($this['AppName']).'\\') === 0) {
444 444
 				return parent::query($name);
445 445
 			}
446 446
 		}
447 447
 
448
-		throw new QueryException('Could not resolve ' . $name . '!' .
448
+		throw new QueryException('Could not resolve '.$name.'!'.
449 449
 			' Class can not be instantiated', 1);
450 450
 	}
451 451
 }
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/Updater.php 1 patch
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -101,43 +101,43 @@  discard block
 block discarded – undo
101 101
 		$this->logAllEvents();
102 102
 
103 103
 		$logLevel = $this->config->getSystemValue('loglevel', ILogger::WARN);
104
-		$this->emit('\OC\Updater', 'setDebugLogLevel', [ $logLevel, $this->logLevelNames[$logLevel] ]);
104
+		$this->emit('\OC\Updater', 'setDebugLogLevel', [$logLevel, $this->logLevelNames[$logLevel]]);
105 105
 		$this->config->setSystemValue('loglevel', ILogger::DEBUG);
106 106
 
107 107
 		$wasMaintenanceModeEnabled = $this->config->getSystemValue('maintenance', false);
108 108
 
109
-		if(!$wasMaintenanceModeEnabled) {
109
+		if (!$wasMaintenanceModeEnabled) {
110 110
 			$this->config->setSystemValue('maintenance', true);
111 111
 			$this->emit('\OC\Updater', 'maintenanceEnabled');
112 112
 		}
113 113
 
114 114
 		$installedVersion = $this->config->getSystemValue('version', '0.0.0');
115 115
 		$currentVersion = implode('.', \OCP\Util::getVersion());
116
-		$this->log->debug('starting upgrade from ' . $installedVersion . ' to ' . $currentVersion, array('app' => 'core'));
116
+		$this->log->debug('starting upgrade from '.$installedVersion.' to '.$currentVersion, array('app' => 'core'));
117 117
 
118 118
 		$success = true;
119 119
 		try {
120 120
 			$this->doUpgrade($currentVersion, $installedVersion);
121 121
 		} catch (HintException $exception) {
122 122
 			$this->log->logException($exception, ['app' => 'core']);
123
-			$this->emit('\OC\Updater', 'failure', array($exception->getMessage() . ': ' .$exception->getHint()));
123
+			$this->emit('\OC\Updater', 'failure', array($exception->getMessage().': '.$exception->getHint()));
124 124
 			$success = false;
125 125
 		} catch (\Exception $exception) {
126 126
 			$this->log->logException($exception, ['app' => 'core']);
127
-			$this->emit('\OC\Updater', 'failure', array(get_class($exception) . ': ' .$exception->getMessage()));
127
+			$this->emit('\OC\Updater', 'failure', array(get_class($exception).': '.$exception->getMessage()));
128 128
 			$success = false;
129 129
 		}
130 130
 
131 131
 		$this->emit('\OC\Updater', 'updateEnd', array($success));
132 132
 
133
-		if(!$wasMaintenanceModeEnabled && $success) {
133
+		if (!$wasMaintenanceModeEnabled && $success) {
134 134
 			$this->config->setSystemValue('maintenance', false);
135 135
 			$this->emit('\OC\Updater', 'maintenanceDisabled');
136 136
 		} else {
137 137
 			$this->emit('\OC\Updater', 'maintenanceActive');
138 138
 		}
139 139
 
140
-		$this->emit('\OC\Updater', 'resetLogLevel', [ $logLevel, $this->logLevelNames[$logLevel] ]);
140
+		$this->emit('\OC\Updater', 'resetLogLevel', [$logLevel, $this->logLevelNames[$logLevel]]);
141 141
 		$this->config->setSystemValue('loglevel', $logLevel);
142 142
 		$this->config->setSystemValue('installed', true);
143 143
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 */
152 152
 	private function getAllowedPreviousVersions() {
153 153
 		// this should really be a JSON file
154
-		require \OC::$SERVERROOT . '/version.php';
154
+		require \OC::$SERVERROOT.'/version.php';
155 155
 		/** @var array $OC_VersionCanBeUpgradedFrom */
156 156
 		return $OC_VersionCanBeUpgradedFrom;
157 157
 	}
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	 */
164 164
 	private function getVendor() {
165 165
 		// this should really be a JSON file
166
-		require \OC::$SERVERROOT . '/version.php';
166
+		require \OC::$SERVERROOT.'/version.php';
167 167
 		/** @var string $vendor */
168 168
 		return (string) $vendor;
169 169
 	}
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 	 */
178 178
 	public function isUpgradePossible($oldVersion, $newVersion, array $allowedPreviousVersions) {
179 179
 		$version = explode('.', $oldVersion);
180
-		$majorMinor = $version[0] . '.' . $version[1];
180
+		$majorMinor = $version[0].'.'.$version[1];
181 181
 
182 182
 		$currentVendor = $this->config->getAppValue('core', 'vendor', '');
183 183
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 		// create empty file in data dir, so we can later find
225 225
 		// out that this is indeed an ownCloud data directory
226 226
 		// (in case it didn't exist before)
227
-		file_put_contents($this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/.ocdata', '');
227
+		file_put_contents($this->config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').'/.ocdata', '');
228 228
 
229 229
 		// pre-upgrade repairs
230 230
 		$repair = new Repair(Repair::getBeforeUpgradeRepairSteps(), \OC::$server->getEventDispatcher());
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 		foreach ($errors as $appId => $exception) {
256 256
 			/** @var \Exception $exception */
257 257
 			$this->log->logException($exception, ['app' => $appId]);
258
-			$this->emit('\OC\Updater', 'failure', [$appId . ': ' . $exception->getMessage()]);
258
+			$this->emit('\OC\Updater', 'failure', [$appId.': '.$exception->getMessage()]);
259 259
 		}
260 260
 
261 261
 		// post-upgrade repairs
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 		$this->config->setAppValue('core', 'lastupdatedat', 0);
267 267
 
268 268
 		// Check for code integrity if not disabled
269
-		if(\OC::$server->getIntegrityCodeChecker()->isCodeCheckEnforced()) {
269
+		if (\OC::$server->getIntegrityCodeChecker()->isCodeCheckEnforced()) {
270 270
 			$this->emit('\OC\Updater', 'startCheckCodeIntegrity');
271 271
 			$this->checker->runInstanceVerification();
272 272
 			$this->emit('\OC\Updater', 'finishedCheckCodeIntegrity');
@@ -307,12 +307,12 @@  discard block
 block discarded – undo
307 307
 				 * @link https://github.com/owncloud/core/issues/10980
308 308
 				 * @see \OC_App::updateApp
309 309
 				 */
310
-				if (file_exists(\OC_App::getAppPath($appId) . '/appinfo/preupdate.php')) {
310
+				if (file_exists(\OC_App::getAppPath($appId).'/appinfo/preupdate.php')) {
311 311
 					$this->includePreUpdate($appId);
312 312
 				}
313
-				if (file_exists(\OC_App::getAppPath($appId) . '/appinfo/database.xml')) {
313
+				if (file_exists(\OC_App::getAppPath($appId).'/appinfo/database.xml')) {
314 314
 					$this->emit('\OC\Updater', 'appSimulateUpdate', array($appId));
315
-					\OC_DB::simulateUpdateDbFromStructure(\OC_App::getAppPath($appId) . '/appinfo/database.xml');
315
+					\OC_DB::simulateUpdateDbFromStructure(\OC_App::getAppPath($appId).'/appinfo/database.xml');
316 316
 				}
317 317
 			}
318 318
 		}
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 	 * @param string $appId
326 326
 	 */
327 327
 	private function includePreUpdate($appId) {
328
-		include \OC_App::getAppPath($appId) . '/appinfo/preupdate.php';
328
+		include \OC_App::getAppPath($appId).'/appinfo/preupdate.php';
329 329
 	}
330 330
 
331 331
 	/**
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 		foreach ($apps as $appId) {
344 344
 			$priorityType = false;
345 345
 			foreach ($priorityTypes as $type) {
346
-				if(!isset($stacks[$type])) {
346
+				if (!isset($stacks[$type])) {
347 347
 					$stacks[$type] = array();
348 348
 				}
349 349
 				if (\OC_App::isType($appId, [$type])) {
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 					\OC_App::updateApp($appId);
364 364
 					$this->emit('\OC\Updater', 'appUpgrade', [$appId, \OC_App::getAppVersion($appId)]);
365 365
 				}
366
-				if($type !== $pseudoOtherType) {
366
+				if ($type !== $pseudoOtherType) {
367 367
 					// load authentication, filesystem and logging apps after
368 368
 					// upgrading them. Other apps my need to rely on modifying
369 369
 					// user and/or filesystem aspects.
@@ -391,9 +391,9 @@  discard block
 block discarded – undo
391 391
 		foreach ($apps as $app) {
392 392
 			// check if the app is compatible with this version of ownCloud
393 393
 			$info = OC_App::getAppInfo($app);
394
-			if($info === null || !OC_App::isAppCompatible($version, $info)) {
394
+			if ($info === null || !OC_App::isAppCompatible($version, $info)) {
395 395
 				if ($appManager->isShipped($app)) {
396
-					throw new \UnexpectedValueException('The files of the app "' . $app . '" were not correctly replaced before running the update');
396
+					throw new \UnexpectedValueException('The files of the app "'.$app.'" were not correctly replaced before running the update');
397 397
 				}
398 398
 				\OC::$server->getAppManager()->disableApp($app);
399 399
 				$this->emit('\OC\Updater', 'incompatibleAppDisabled', array($app));
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 	 * @throws \Exception
432 432
 	 */
433 433
 	private function upgradeAppStoreApps(array $disabledApps) {
434
-		foreach($disabledApps as $app) {
434
+		foreach ($disabledApps as $app) {
435 435
 			try {
436 436
 				$this->emit('\OC\Updater', 'checkAppStoreAppBefore', [$app]);
437 437
 				if ($this->installer->isUpdateAvailable($app)) {
@@ -450,22 +450,22 @@  discard block
 block discarded – undo
450 450
 	 */
451 451
 	private function emitRepairEvents() {
452 452
 		$dispatcher = \OC::$server->getEventDispatcher();
453
-		$dispatcher->addListener('\OC\Repair::warning', function ($event) {
453
+		$dispatcher->addListener('\OC\Repair::warning', function($event) {
454 454
 			if ($event instanceof GenericEvent) {
455 455
 				$this->emit('\OC\Updater', 'repairWarning', $event->getArguments());
456 456
 			}
457 457
 		});
458
-		$dispatcher->addListener('\OC\Repair::error', function ($event) {
458
+		$dispatcher->addListener('\OC\Repair::error', function($event) {
459 459
 			if ($event instanceof GenericEvent) {
460 460
 				$this->emit('\OC\Updater', 'repairError', $event->getArguments());
461 461
 			}
462 462
 		});
463
-		$dispatcher->addListener('\OC\Repair::info', function ($event) {
463
+		$dispatcher->addListener('\OC\Repair::info', function($event) {
464 464
 			if ($event instanceof GenericEvent) {
465 465
 				$this->emit('\OC\Updater', 'repairInfo', $event->getArguments());
466 466
 			}
467 467
 		});
468
-		$dispatcher->addListener('\OC\Repair::step', function ($event) {
468
+		$dispatcher->addListener('\OC\Repair::step', function($event) {
469 469
 			if ($event instanceof GenericEvent) {
470 470
 				$this->emit('\OC\Updater', 'repairStep', $event->getArguments());
471 471
 			}
@@ -480,13 +480,13 @@  discard block
 block discarded – undo
480 480
 			if (!$event instanceof GenericEvent) {
481 481
 				return;
482 482
 			}
483
-			$log->info('\OC\DB\Migrator::executeSql: ' . $event->getSubject() . ' (' . $event->getArgument(0) . ' of ' . $event->getArgument(1) . ')', ['app' => 'updater']);
483
+			$log->info('\OC\DB\Migrator::executeSql: '.$event->getSubject().' ('.$event->getArgument(0).' of '.$event->getArgument(1).')', ['app' => 'updater']);
484 484
 		});
485 485
 		$dispatcher->addListener('\OC\DB\Migrator::checkTable', function($event) use ($log) {
486 486
 			if (!$event instanceof GenericEvent) {
487 487
 				return;
488 488
 			}
489
-			$log->info('\OC\DB\Migrator::checkTable: ' . $event->getSubject() . ' (' . $event->getArgument(0) . ' of ' . $event->getArgument(1) . ')', ['app' => 'updater']);
489
+			$log->info('\OC\DB\Migrator::checkTable: '.$event->getSubject().' ('.$event->getArgument(0).' of '.$event->getArgument(1).')', ['app' => 'updater']);
490 490
 		});
491 491
 
492 492
 		$repairListener = function($event) use ($log) {
@@ -495,30 +495,30 @@  discard block
 block discarded – undo
495 495
 			}
496 496
 			switch ($event->getSubject()) {
497 497
 				case '\OC\Repair::startProgress':
498
-					$log->info('\OC\Repair::startProgress: Starting ... ' . $event->getArgument(1) .  ' (' . $event->getArgument(0) . ')', ['app' => 'updater']);
498
+					$log->info('\OC\Repair::startProgress: Starting ... '.$event->getArgument(1).' ('.$event->getArgument(0).')', ['app' => 'updater']);
499 499
 					break;
500 500
 				case '\OC\Repair::advance':
501 501
 					$desc = $event->getArgument(1);
502 502
 					if (empty($desc)) {
503 503
 						$desc = '';
504 504
 					}
505
-					$log->info('\OC\Repair::advance: ' . $desc . ' (' . $event->getArgument(0) . ')', ['app' => 'updater']);
505
+					$log->info('\OC\Repair::advance: '.$desc.' ('.$event->getArgument(0).')', ['app' => 'updater']);
506 506
 
507 507
 					break;
508 508
 				case '\OC\Repair::finishProgress':
509 509
 					$log->info('\OC\Repair::finishProgress', ['app' => 'updater']);
510 510
 					break;
511 511
 				case '\OC\Repair::step':
512
-					$log->info('\OC\Repair::step: Repair step: ' . $event->getArgument(0), ['app' => 'updater']);
512
+					$log->info('\OC\Repair::step: Repair step: '.$event->getArgument(0), ['app' => 'updater']);
513 513
 					break;
514 514
 				case '\OC\Repair::info':
515
-					$log->info('\OC\Repair::info: Repair info: ' . $event->getArgument(0), ['app' => 'updater']);
515
+					$log->info('\OC\Repair::info: Repair info: '.$event->getArgument(0), ['app' => 'updater']);
516 516
 					break;
517 517
 				case '\OC\Repair::warning':
518
-					$log->warning('\OC\Repair::warning: Repair warning: ' . $event->getArgument(0), ['app' => 'updater']);
518
+					$log->warning('\OC\Repair::warning: Repair warning: '.$event->getArgument(0), ['app' => 'updater']);
519 519
 					break;
520 520
 				case '\OC\Repair::error':
521
-					$log->error('\OC\Repair::error: Repair error: ' . $event->getArgument(0), ['app' => 'updater']);
521
+					$log->error('\OC\Repair::error: Repair error: '.$event->getArgument(0), ['app' => 'updater']);
522 522
 					break;
523 523
 			}
524 524
 		};
@@ -532,74 +532,74 @@  discard block
 block discarded – undo
532 532
 		$dispatcher->addListener('\OC\Repair::error', $repairListener);
533 533
 
534 534
 
535
-		$this->listen('\OC\Updater', 'maintenanceEnabled', function () use($log) {
535
+		$this->listen('\OC\Updater', 'maintenanceEnabled', function() use($log) {
536 536
 			$log->info('\OC\Updater::maintenanceEnabled: Turned on maintenance mode', ['app' => 'updater']);
537 537
 		});
538
-		$this->listen('\OC\Updater', 'maintenanceDisabled', function () use($log) {
538
+		$this->listen('\OC\Updater', 'maintenanceDisabled', function() use($log) {
539 539
 			$log->info('\OC\Updater::maintenanceDisabled: Turned off maintenance mode', ['app' => 'updater']);
540 540
 		});
541
-		$this->listen('\OC\Updater', 'maintenanceActive', function () use($log) {
541
+		$this->listen('\OC\Updater', 'maintenanceActive', function() use($log) {
542 542
 			$log->info('\OC\Updater::maintenanceActive: Maintenance mode is kept active', ['app' => 'updater']);
543 543
 		});
544
-		$this->listen('\OC\Updater', 'updateEnd', function ($success) use($log) {
544
+		$this->listen('\OC\Updater', 'updateEnd', function($success) use($log) {
545 545
 			if ($success) {
546 546
 				$log->info('\OC\Updater::updateEnd: Update successful', ['app' => 'updater']);
547 547
 			} else {
548 548
 				$log->error('\OC\Updater::updateEnd: Update failed', ['app' => 'updater']);
549 549
 			}
550 550
 		});
551
-		$this->listen('\OC\Updater', 'dbUpgradeBefore', function () use($log) {
551
+		$this->listen('\OC\Updater', 'dbUpgradeBefore', function() use($log) {
552 552
 			$log->info('\OC\Updater::dbUpgradeBefore: Updating database schema', ['app' => 'updater']);
553 553
 		});
554
-		$this->listen('\OC\Updater', 'dbUpgrade', function () use($log) {
554
+		$this->listen('\OC\Updater', 'dbUpgrade', function() use($log) {
555 555
 			$log->info('\OC\Updater::dbUpgrade: Updated database', ['app' => 'updater']);
556 556
 		});
557
-		$this->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function () use($log) {
557
+		$this->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function() use($log) {
558 558
 			$log->info('\OC\Updater::dbSimulateUpgradeBefore: Checking whether the database schema can be updated (this can take a long time depending on the database size)', ['app' => 'updater']);
559 559
 		});
560
-		$this->listen('\OC\Updater', 'dbSimulateUpgrade', function () use($log) {
560
+		$this->listen('\OC\Updater', 'dbSimulateUpgrade', function() use($log) {
561 561
 			$log->info('\OC\Updater::dbSimulateUpgrade: Checked database schema update', ['app' => 'updater']);
562 562
 		});
563
-		$this->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use($log) {
564
-			$log->info('\OC\Updater::incompatibleAppDisabled: Disabled incompatible app: ' . $app, ['app' => 'updater']);
563
+		$this->listen('\OC\Updater', 'incompatibleAppDisabled', function($app) use($log) {
564
+			$log->info('\OC\Updater::incompatibleAppDisabled: Disabled incompatible app: '.$app, ['app' => 'updater']);
565 565
 		});
566
-		$this->listen('\OC\Updater', 'checkAppStoreAppBefore', function ($app) use($log) {
567
-			$log->info('\OC\Updater::checkAppStoreAppBefore: Checking for update of app "' . $app . '" in appstore', ['app' => 'updater']);
566
+		$this->listen('\OC\Updater', 'checkAppStoreAppBefore', function($app) use($log) {
567
+			$log->info('\OC\Updater::checkAppStoreAppBefore: Checking for update of app "'.$app.'" in appstore', ['app' => 'updater']);
568 568
 		});
569
-		$this->listen('\OC\Updater', 'upgradeAppStoreApp', function ($app) use($log) {
570
-			$log->info('\OC\Updater::upgradeAppStoreApp: Update app "' . $app . '" from appstore', ['app' => 'updater']);
569
+		$this->listen('\OC\Updater', 'upgradeAppStoreApp', function($app) use($log) {
570
+			$log->info('\OC\Updater::upgradeAppStoreApp: Update app "'.$app.'" from appstore', ['app' => 'updater']);
571 571
 		});
572
-		$this->listen('\OC\Updater', 'checkAppStoreApp', function ($app) use($log) {
573
-			$log->info('\OC\Updater::checkAppStoreApp: Checked for update of app "' . $app . '" in appstore', ['app' => 'updater']);
572
+		$this->listen('\OC\Updater', 'checkAppStoreApp', function($app) use($log) {
573
+			$log->info('\OC\Updater::checkAppStoreApp: Checked for update of app "'.$app.'" in appstore', ['app' => 'updater']);
574 574
 		});
575
-		$this->listen('\OC\Updater', 'appUpgradeCheckBefore', function () use ($log) {
575
+		$this->listen('\OC\Updater', 'appUpgradeCheckBefore', function() use ($log) {
576 576
 			$log->info('\OC\Updater::appUpgradeCheckBefore: Checking updates of apps', ['app' => 'updater']);
577 577
 		});
578
-		$this->listen('\OC\Updater', 'appSimulateUpdate', function ($app) use ($log) {
579
-			$log->info('\OC\Updater::appSimulateUpdate: Checking whether the database schema for <' . $app . '> can be updated (this can take a long time depending on the database size)', ['app' => 'updater']);
578
+		$this->listen('\OC\Updater', 'appSimulateUpdate', function($app) use ($log) {
579
+			$log->info('\OC\Updater::appSimulateUpdate: Checking whether the database schema for <'.$app.'> can be updated (this can take a long time depending on the database size)', ['app' => 'updater']);
580 580
 		});
581
-		$this->listen('\OC\Updater', 'appUpgradeCheck', function () use ($log) {
581
+		$this->listen('\OC\Updater', 'appUpgradeCheck', function() use ($log) {
582 582
 			$log->info('\OC\Updater::appUpgradeCheck: Checked database schema update for apps', ['app' => 'updater']);
583 583
 		});
584
-		$this->listen('\OC\Updater', 'appUpgradeStarted', function ($app) use ($log) {
585
-			$log->info('\OC\Updater::appUpgradeStarted: Updating <' . $app . '> ...', ['app' => 'updater']);
584
+		$this->listen('\OC\Updater', 'appUpgradeStarted', function($app) use ($log) {
585
+			$log->info('\OC\Updater::appUpgradeStarted: Updating <'.$app.'> ...', ['app' => 'updater']);
586 586
 		});
587
-		$this->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($log) {
588
-			$log->info('\OC\Updater::appUpgrade: Updated <' . $app . '> to ' . $version, ['app' => 'updater']);
587
+		$this->listen('\OC\Updater', 'appUpgrade', function($app, $version) use ($log) {
588
+			$log->info('\OC\Updater::appUpgrade: Updated <'.$app.'> to '.$version, ['app' => 'updater']);
589 589
 		});
590
-		$this->listen('\OC\Updater', 'failure', function ($message) use($log) {
591
-			$log->error('\OC\Updater::failure: ' . $message, ['app' => 'updater']);
590
+		$this->listen('\OC\Updater', 'failure', function($message) use($log) {
591
+			$log->error('\OC\Updater::failure: '.$message, ['app' => 'updater']);
592 592
 		});
593
-		$this->listen('\OC\Updater', 'setDebugLogLevel', function () use($log) {
593
+		$this->listen('\OC\Updater', 'setDebugLogLevel', function() use($log) {
594 594
 			$log->info('\OC\Updater::setDebugLogLevel: Set log level to debug', ['app' => 'updater']);
595 595
 		});
596
-		$this->listen('\OC\Updater', 'resetLogLevel', function ($logLevel, $logLevelName) use($log) {
597
-			$log->info('\OC\Updater::resetLogLevel: Reset log level to ' . $logLevelName . '(' . $logLevel . ')', ['app' => 'updater']);
596
+		$this->listen('\OC\Updater', 'resetLogLevel', function($logLevel, $logLevelName) use($log) {
597
+			$log->info('\OC\Updater::resetLogLevel: Reset log level to '.$logLevelName.'('.$logLevel.')', ['app' => 'updater']);
598 598
 		});
599
-		$this->listen('\OC\Updater', 'startCheckCodeIntegrity', function () use($log) {
599
+		$this->listen('\OC\Updater', 'startCheckCodeIntegrity', function() use($log) {
600 600
 			$log->info('\OC\Updater::startCheckCodeIntegrity: Starting code integrity check...', ['app' => 'updater']);
601 601
 		});
602
-		$this->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function () use($log) {
602
+		$this->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function() use($log) {
603 603
 			$log->info('\OC\Updater::finishedCheckCodeIntegrity: Finished code integrity check', ['app' => 'updater']);
604 604
 		});
605 605
 
Please login to merge, or discard this patch.