Completed
Push — master ( a01e85...1c7e4a )
by
unknown
32:48 queued 15s
created
lib/public/Util.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -261,9 +261,9 @@  discard block
 block discarded – undo
261 261
 	 */
262 262
 	public static function linkToRemote($service) {
263 263
 		$urlGenerator = \OC::$server->getURLGenerator();
264
-		$remoteBase = $urlGenerator->linkTo('', 'remote.php') . '/' . $service;
264
+		$remoteBase = $urlGenerator->linkTo('', 'remote.php').'/'.$service;
265 265
 		return $urlGenerator->getAbsoluteURL(
266
-			$remoteBase . (($service[strlen($service) - 1] != '/') ? '/' : '')
266
+			$remoteBase.(($service[strlen($service) - 1] != '/') ? '/' : '')
267 267
 		);
268 268
 	}
269 269
 
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 		$user_part = $config->getSystemValueString('mail_from_address', $user_part);
304 304
 		$host_name = self::getServerHostName();
305 305
 		$host_name = $config->getSystemValueString('mail_domain', $host_name);
306
-		$defaultEmailAddress = $user_part . '@' . $host_name;
306
+		$defaultEmailAddress = $user_part.'@'.$host_name;
307 307
 
308 308
 		$mailer = \OC::$server->get(IMailer::class);
309 309
 		if ($mailer->validateMailAddress($defaultEmailAddress)) {
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 		}
312 312
 
313 313
 		// in case we cannot build a valid email address from the hostname let's fallback to 'localhost.localdomain'
314
-		return $user_part . '@localhost.localdomain';
314
+		return $user_part.'@localhost.localdomain';
315 315
 	}
316 316
 
317 317
 	/**
@@ -320,9 +320,9 @@  discard block
 block discarded – undo
320 320
 	 * @return int|float int if it fits, float if it is too big
321 321
 	 * @since 26.0.0
322 322
 	 */
323
-	public static function numericToNumber(string|float|int $number): int|float {
323
+	public static function numericToNumber(string | float | int $number): int | float {
324 324
 		/* This is a hack to cast to (int|float) */
325
-		return 0 + (string)$number;
325
+		return 0 + (string) $number;
326 326
 	}
327 327
 
328 328
 	/**
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 	 * @return string a human readable file size
332 332
 	 * @since 4.0.0
333 333
 	 */
334
-	public static function humanFileSize(int|float $bytes): string {
334
+	public static function humanFileSize(int | float $bytes): string {
335 335
 		if ($bytes < 0) {
336 336
 			return '?';
337 337
 		}
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 	 * @return false|int|float a file size in bytes
368 368
 	 * @since 4.0.0
369 369
 	 */
370
-	public static function computerFileSize(string $str): false|int|float {
370
+	public static function computerFileSize(string $str): false | int | float {
371 371
 		$str = strtolower($str);
372 372
 		if (is_numeric($str)) {
373 373
 			return Util::numericToNumber($str);
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
 			'p' => 1024 * 1024 * 1024 * 1024 * 1024,
388 388
 		];
389 389
 
390
-		$bytes = (float)$str;
390
+		$bytes = (float) $str;
391 391
 
392 392
 		if (preg_match('#([kmgtp]?b?)$#si', $str, $matches) && isset($bytes_array[$matches[1]])) {
393 393
 			$bytes *= $bytes_array[$matches[1]];
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
 	 * @return int|float number of bytes representing
517 517
 	 * @since 5.0.0
518 518
 	 */
519
-	public static function maxUploadFilesize(string $dir, int|float|null $free = null): int|float {
519
+	public static function maxUploadFilesize(string $dir, int | float | null $free = null): int | float {
520 520
 		return \OC_Helper::maxUploadFilesize($dir, $free);
521 521
 	}
522 522
 
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 	 * @return int|float number of bytes representing
527 527
 	 * @since 7.0.0
528 528
 	 */
529
-	public static function freeSpace(string $dir): int|float {
529
+	public static function freeSpace(string $dir): int | float {
530 530
 		return \OC_Helper::freeSpace($dir);
531 531
 	}
532 532
 
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
 	 * @return int|float number of bytes representing
537 537
 	 * @since 7.0.0
538 538
 	 */
539
-	public static function uploadLimit(): int|float {
539
+	public static function uploadLimit(): int | float {
540 540
 		return \OC_Helper::uploadLimit();
541 541
 	}
542 542
 
Please login to merge, or discard this patch.
lib/private/legacy/OC_Helper.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 *
44 44
 	 * Makes 2048 to 2 kB.
45 45
 	 */
46
-	public static function humanFileSize(int|float $bytes): string {
46
+	public static function humanFileSize(int | float $bytes): string {
47 47
 		return \OCP\Util::humanFileSize($bytes);
48 48
 	}
49 49
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 *
58 58
 	 * Inspired by: https://www.php.net/manual/en/function.filesize.php#92418
59 59
 	 */
60
-	public static function computerFileSize(string $str): false|int|float {
60
+	public static function computerFileSize(string $str): false | int | float {
61 61
 		return \OCP\Util::computerFileSize($str);
62 62
 	}
63 63
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 		}
172 172
 		foreach ($dirs as $dir) {
173 173
 			foreach ($exts as $ext) {
174
-				if ($check_fn("$dir/$name" . $ext)) {
174
+				if ($check_fn("$dir/$name".$ext)) {
175 175
 					return true;
176 176
 				}
177 177
 			}
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 			$ext = '';
244 244
 		}
245 245
 
246
-		$newpath = $path . '/' . $filename;
246
+		$newpath = $path.'/'.$filename;
247 247
 		if ($view->file_exists($newpath)) {
248 248
 			if (preg_match_all('/\((\d+)\)/', $name, $matches, PREG_OFFSET_CAPTURE)) {
249 249
 				//Replace the last "(number)" with "(number+1)"
@@ -259,11 +259,11 @@  discard block
 block discarded – undo
259 259
 			do {
260 260
 				if ($offset) {
261 261
 					//Replace the last "(number)" with "(number+1)"
262
-					$newname = substr_replace($name, '(' . $counter . ')', $offset, $match_length);
262
+					$newname = substr_replace($name, '('.$counter.')', $offset, $match_length);
263 263
 				} else {
264
-					$newname = $name . ' (' . $counter . ')';
264
+					$newname = $name.' ('.$counter.')';
265 265
 				}
266
-				$newpath = $path . '/' . $newname . $ext;
266
+				$newpath = $path.'/'.$newname.$ext;
267 267
 				$counter++;
268 268
 			} while ($view->file_exists($newpath));
269 269
 		}
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 			$freeSpace = max($freeSpace, 0);
345 345
 			return $freeSpace;
346 346
 		} else {
347
-			return (INF > 0)? INF: PHP_INT_MAX; // work around https://bugs.php.net/bug.php?id=69188
347
+			return (INF > 0) ? INF: PHP_INT_MAX; // work around https://bugs.php.net/bug.php?id=69188
348 348
 		}
349 349
 	}
350 350
 
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 		}
416 416
 		$fullPath = Filesystem::normalizePath($view->getAbsolutePath($path));
417 417
 
418
-		$cacheKey = $fullPath . '::' . ($includeMountPoints ? 'include' : 'exclude');
418
+		$cacheKey = $fullPath.'::'.($includeMountPoints ? 'include' : 'exclude');
419 419
 		if ($useCache) {
420 420
 			$cached = $memcache->get($cacheKey);
421 421
 			if ($cached) {
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 
527 527
 		if ($isRemoteShare === false && $ownerId !== false && $path === '/') {
528 528
 			// If path is root, store this as last known quota usage for this user
529
-			\OCP\Server::get(\OCP\IConfig::class)->setUserValue($ownerId, 'files', 'lastSeenQuotaUsage', (string)$relative);
529
+			\OCP\Server::get(\OCP\IConfig::class)->setUserValue($ownerId, 'files', 'lastSeenQuotaUsage', (string) $relative);
530 530
 		}
531 531
 
532 532
 		$memcache->set($cacheKey, $info, 5 * 60);
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 	 * @psalm-suppress LessSpecificReturnStatement Legacy code outputs weird types - manually validated that they are correct
541 541
 	 * @return StorageInfo
542 542
 	 */
543
-	private static function getGlobalStorageInfo(int|float $quota, IUser $user, IMountPoint $mount): array {
543
+	private static function getGlobalStorageInfo(int | float $quota, IUser $user, IMountPoint $mount): array {
544 544
 		$rootInfo = \OC\Files\Filesystem::getFileInfo('', 'ext');
545 545
 		/** @var int|float $used */
546 546
 		$used = $rootInfo['size'];
@@ -585,9 +585,9 @@  discard block
 block discarded – undo
585 585
 		/** @var ICacheFactory $cacheFactory */
586 586
 		$cacheFactory = \OC::$server->get(ICacheFactory::class);
587 587
 		$memcache = $cacheFactory->createLocal('storage_info');
588
-		$cacheKeyPrefix = Filesystem::normalizePath($absolutePath) . '::';
589
-		$memcache->remove($cacheKeyPrefix . 'include');
590
-		$memcache->remove($cacheKeyPrefix . 'exclude');
588
+		$cacheKeyPrefix = Filesystem::normalizePath($absolutePath).'::';
589
+		$memcache->remove($cacheKeyPrefix.'include');
590
+		$memcache->remove($cacheKeyPrefix.'exclude');
591 591
 	}
592 592
 
593 593
 	/**
Please login to merge, or discard this patch.
lib/private/User/User.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 	 */
205 205
 	public function getLastLogin(): int {
206 206
 		if ($this->lastLogin === null) {
207
-			$this->lastLogin = (int)$this->config->getUserValue($this->uid, 'login', 'lastLogin', 0);
207
+			$this->lastLogin = (int) $this->config->getUserValue($this->uid, 'login', 'lastLogin', 0);
208 208
 		}
209 209
 		return $this->lastLogin;
210 210
 	}
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 	 */
216 216
 	public function getFirstLogin(): int {
217 217
 		if ($this->firstLogin === null) {
218
-			$this->firstLogin = (int)$this->config->getUserValue($this->uid, 'login', 'firstLogin', 0);
218
+			$this->firstLogin = (int) $this->config->getUserValue($this->uid, 'login', 'firstLogin', 0);
219 219
 		}
220 220
 		return $this->firstLogin;
221 221
 	}
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 
232 232
 		if ($now - $previousLogin > 60) {
233 233
 			$this->lastLogin = $now;
234
-			$this->config->setUserValue($this->uid, 'login', 'lastLogin', (string)$this->lastLogin);
234
+			$this->config->setUserValue($this->uid, 'login', 'lastLogin', (string) $this->lastLogin);
235 235
 		}
236 236
 
237 237
 		if ($firstLogin === 0) {
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 				/* Unknown first login, most likely was before upgrade to Nextcloud 31 */
242 242
 				$this->firstLogin = -1;
243 243
 			}
244
-			$this->config->setUserValue($this->uid, 'login', 'firstLogin', (string)$this->firstLogin);
244
+			$this->config->setUserValue($this->uid, 'login', 'firstLogin', (string) $this->firstLogin);
245 245
 		}
246 246
 
247 247
 		return $firstTimeLogin;
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 			if (($this->backend instanceof IGetHomeBackend || $this->backend->implementsActions(Backend::GET_HOME)) && $home = $this->backend->getHome($this->uid)) {
390 390
 				$this->home = $home;
391 391
 			} else {
392
-				$this->home = $this->config->getSystemValueString('datadirectory', \OC::$SERVERROOT . '/data') . '/' . $this->uid;
392
+				$this->home = $this->config->getSystemValueString('datadirectory', \OC::$SERVERROOT.'/data').'/'.$this->uid;
393 393
 			}
394 394
 		}
395 395
 		return $this->home;
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 	 * @return bool
458 458
 	 */
459 459
 	public function isEnabled() {
460
-		$queryDatabaseValue = function (): bool {
460
+		$queryDatabaseValue = function(): bool {
461 461
 			if ($this->enabled === null) {
462 462
 				$enabled = $this->config->getUserValue($this->uid, 'core', 'enabled', 'true');
463 463
 				$this->enabled = $enabled === 'true';
@@ -478,12 +478,12 @@  discard block
 block discarded – undo
478 478
 	 */
479 479
 	public function setEnabled(bool $enabled = true) {
480 480
 		$oldStatus = $this->isEnabled();
481
-		$setDatabaseValue = function (bool $enabled): void {
481
+		$setDatabaseValue = function(bool $enabled): void {
482 482
 			$this->config->setUserValue($this->uid, 'core', 'enabled', $enabled ? 'true' : 'false');
483 483
 			$this->enabled = $enabled;
484 484
 		};
485 485
 		if ($this->backend instanceof IProvideEnabledStateBackend) {
486
-			$queryDatabaseValue = function (): bool {
486
+			$queryDatabaseValue = function(): bool {
487 487
 				if ($this->enabled === null) {
488 488
 					$enabled = $this->config->getUserValue($this->uid, 'core', 'enabled', 'true');
489 489
 					$this->enabled = $enabled === 'true';
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 		if ($quota !== 'none' and $quota !== 'default') {
572 572
 			$bytesQuota = \OCP\Util::computerFileSize($quota);
573 573
 			if ($bytesQuota === false) {
574
-				throw new InvalidArgumentException('Failed to set quota to invalid value ' . $quota);
574
+				throw new InvalidArgumentException('Failed to set quota to invalid value '.$quota);
575 575
 			}
576 576
 			$quota = \OCP\Util::humanFileSize($bytesQuota);
577 577
 		}
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
 			$this->config->setUserValue($this->uid, 'files', 'quota', $quota);
580 580
 			$this->triggerChange('quota', $quota, $oldQuota);
581 581
 		}
582
-		\OC_Helper::clearStorageInfo('/' . $this->uid . '/files');
582
+		\OC_Helper::clearStorageInfo('/'.$this->uid.'/files');
583 583
 	}
584 584
 
585 585
 	public function getManagerUids(): array {
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
 			$server = substr($server, 0, -10);
639 639
 		}
640 640
 		$server = $this->removeProtocolFromUrl($server);
641
-		return $uid . '@' . $server;
641
+		return $uid.'@'.$server;
642 642
 	}
643 643
 
644 644
 	private function removeProtocolFromUrl(string $url): string {
Please login to merge, or discard this patch.
apps/files_trashbin/lib/Command/Size.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
 				return -1;
52 52
 			}
53 53
 			if ($user) {
54
-				$this->config->setUserValue($user, 'files_trashbin', 'trashbin_size', (string)$parsedSize);
54
+				$this->config->setUserValue($user, 'files_trashbin', 'trashbin_size', (string) $parsedSize);
55 55
 				$this->commandBus->push(new Expire($user));
56 56
 			} else {
57
-				$this->config->setAppValue('files_trashbin', 'trashbin_size', (string)$parsedSize);
57
+				$this->config->setAppValue('files_trashbin', 'trashbin_size', (string) $parsedSize);
58 58
 				$output->writeln('<info>Warning: changing the default trashbin size will automatically trigger cleanup of existing trashbins,</info>');
59 59
 				$output->writeln('<info>a users trashbin can exceed the configured size until they move a new file to the trashbin.</info>');
60 60
 			}
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	}
67 67
 
68 68
 	private function printTrashbinSize(InputInterface $input, OutputInterface $output, ?string $user) {
69
-		$globalSize = (int)$this->config->getAppValue('files_trashbin', 'trashbin_size', '-1');
69
+		$globalSize = (int) $this->config->getAppValue('files_trashbin', 'trashbin_size', '-1');
70 70
 		if ($globalSize < 0) {
71 71
 			$globalHumanSize = 'default (50% of available space)';
72 72
 		} else {
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 		}
75 75
 
76 76
 		if ($user) {
77
-			$userSize = (int)$this->config->getUserValue($user, 'files_trashbin', 'trashbin_size', '-1');
77
+			$userSize = (int) $this->config->getUserValue($user, 'files_trashbin', 'trashbin_size', '-1');
78 78
 
79 79
 			if ($userSize < 0) {
80 80
 				$userHumanSize = ($globalSize < 0) ? $globalHumanSize : "default($globalHumanSize)";
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 			}
96 96
 		} else {
97 97
 			$users = [];
98
-			$this->userManager->callForSeenUsers(function (IUser $user) use (&$users): void {
98
+			$this->userManager->callForSeenUsers(function(IUser $user) use (&$users): void {
99 99
 				$users[] = $user->getUID();
100 100
 			});
101 101
 			$userValues = $this->config->getUserValueForUsers('files_trashbin', 'trashbin_size', $users);
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 				$output->writeln('');
106 106
 				if (count($userValues)) {
107 107
 					$output->writeln('Per-user sizes:');
108
-					$this->writeArrayInOutputFormat($input, $output, array_map(function ($size) {
108
+					$this->writeArrayInOutputFormat($input, $output, array_map(function($size) {
109 109
 						return \OCP\Util::humanFileSize($size);
110 110
 					}, $userValues));
111 111
 				} else {
Please login to merge, or discard this patch.
apps/files_trashbin/lib/Command/CleanUp.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -91,12 +91,12 @@
 block discarded – undo
91 91
 	protected function removeDeletedFiles(string $uid, OutputInterface $output, bool $verbose): void {
92 92
 		\OC_Util::tearDownFS();
93 93
 		\OC_Util::setupFS($uid);
94
-		$path = '/' . $uid . '/files_trashbin';
94
+		$path = '/'.$uid.'/files_trashbin';
95 95
 		if ($this->rootFolder->nodeExists($path)) {
96 96
 			$node = $this->rootFolder->get($path);
97 97
 
98 98
 			if ($verbose) {
99
-				$output->writeln('Deleting <info>' . \OCP\Util::humanFileSize($node->getSize()) . "</info> in trash for <info>$uid</info>.");
99
+				$output->writeln('Deleting <info>'.\OCP\Util::humanFileSize($node->getSize())."</info> in trash for <info>$uid</info>.");
100 100
 			}
101 101
 			$node->delete();
102 102
 			if ($this->rootFolder->nodeExists($path)) {
Please login to merge, or discard this patch.