Passed
Push — master ( 62403d...0c3e2f )
by Joas
14:50 queued 14s
created
cron.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
  *
36 36
  */
37 37
 
38
-require_once __DIR__ . '/lib/versioncheck.php';
38
+require_once __DIR__.'/lib/versioncheck.php';
39 39
 
40 40
 try {
41 41
 
42
-	require_once __DIR__ . '/lib/base.php';
42
+	require_once __DIR__.'/lib/base.php';
43 43
 
44 44
 	if (\OCP\Util::needUpgrade()) {
45 45
 		\OC::$server->getLogger()->debug('Update required, skipping cron', ['app' => 'cron']);
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	$appMode = $config->getAppValue('core', 'backgroundjobs_mode', 'ajax');
76 76
 	if ($appMode === 'none') {
77 77
 		if (OC::$CLI) {
78
-			echo 'Background Jobs are disabled!' . PHP_EOL;
78
+			echo 'Background Jobs are disabled!'.PHP_EOL;
79 79
 		} else {
80 80
 			OC_JSON::error(['data' => ['message' => 'Background jobs disabled!']]);
81 81
 		}
@@ -90,16 +90,16 @@  discard block
 block discarded – undo
90 90
 
91 91
 		// the cron job must be executed with the right user
92 92
 		if (!function_exists('posix_getuid')) {
93
-			echo "The posix extensions are required - see http://php.net/manual/en/book.posix.php" . PHP_EOL;
93
+			echo "The posix extensions are required - see http://php.net/manual/en/book.posix.php".PHP_EOL;
94 94
 			exit(1);
95 95
 		}
96 96
 
97 97
 		$user = posix_getpwuid(posix_getuid());
98
-		$configUser = posix_getpwuid(fileowner(OC::$configDir . 'config.php'));
98
+		$configUser = posix_getpwuid(fileowner(OC::$configDir.'config.php'));
99 99
 		if ($user['name'] !== $configUser['name']) {
100
-			echo "Console has to be executed with the user that owns the file config/config.php" . PHP_EOL;
101
-			echo "Current user: " . $user['name'] . PHP_EOL;
102
-			echo "Owner of config.php: " . $configUser['name'] . PHP_EOL;
100
+			echo "Console has to be executed with the user that owns the file config/config.php".PHP_EOL;
101
+			echo "Current user: ".$user['name'].PHP_EOL;
102
+			echo "Owner of config.php: ".$configUser['name'].PHP_EOL;
103 103
 			exit(1);
104 104
 		}
105 105
 
Please login to merge, or discard this patch.
apps/cloud_federation_api/lib/Controller/RequestHandlerController.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 		$supportedShareTypes = $this->config->getSupportedShareTypes($resourceType);
146 146
 		if (!in_array($shareType, $supportedShareTypes)) {
147 147
 			return new JSONResponse(
148
-				['message' => 'Share type "' . $shareType . '" not implemented'],
148
+				['message' => 'Share type "'.$shareType.'" not implemented'],
149 149
 				Http::STATUS_NOT_IMPLEMENTED
150 150
 			);
151 151
 		}
@@ -158,16 +158,16 @@  discard block
 block discarded – undo
158 158
 
159 159
 			if (!$this->userManager->userExists($shareWith)) {
160 160
 				return new JSONResponse(
161
-					['message' => 'User "' . $shareWith . '" does not exists at ' . $this->urlGenerator->getBaseUrl()],
161
+					['message' => 'User "'.$shareWith.'" does not exists at '.$this->urlGenerator->getBaseUrl()],
162 162
 					Http::STATUS_BAD_REQUEST
163 163
 				);
164 164
 			}
165 165
 		}
166 166
 
167 167
 		if ($shareType === 'group') {
168
-			if(!$this->groupManager->groupExists($shareWith)) {
168
+			if (!$this->groupManager->groupExists($shareWith)) {
169 169
 				return new JSONResponse(
170
-					['message' => 'Group "' . $shareWith . '" does not exists at ' . $this->urlGenerator->getBaseUrl()],
170
+					['message' => 'Group "'.$shareWith.'" does not exists at '.$this->urlGenerator->getBaseUrl()],
171 171
 					Http::STATUS_BAD_REQUEST
172 172
 				);
173 173
 			}
@@ -200,14 +200,14 @@  discard block
 block discarded – undo
200 200
 			);
201 201
 		} catch (\Exception $e) {
202 202
 			return new JSONResponse(
203
-				['message' => 'Internal error at ' . $this->urlGenerator->getBaseUrl()],
203
+				['message' => 'Internal error at '.$this->urlGenerator->getBaseUrl()],
204 204
 				Http::STATUS_BAD_REQUEST
205 205
 			);
206 206
 		}
207 207
 
208 208
 		$user = $this->userManager->get($shareWith);
209 209
 		$recipientDisplayName = '';
210
-		if($user) {
210
+		if ($user) {
211 211
 			$recipientDisplayName = $user->getDisplayName();
212 212
 		}
213 213
 
@@ -269,12 +269,12 @@  discard block
 block discarded – undo
269 269
 		}
270 270
 		catch (\Exception $e) {
271 271
 			return new JSONResponse(
272
-				['message' => 'Internal error at ' . $this->urlGenerator->getBaseUrl()],
272
+				['message' => 'Internal error at '.$this->urlGenerator->getBaseUrl()],
273 273
 				Http::STATUS_BAD_REQUEST
274 274
 			);
275 275
 		}
276 276
 
277
-		return new JSONResponse($result,Http::STATUS_CREATED);
277
+		return new JSONResponse($result, Http::STATUS_CREATED);
278 278
 
279 279
 	}
280 280
 
@@ -286,13 +286,13 @@  discard block
 block discarded – undo
286 286
 	 */
287 287
 	private function mapUid($uid) {
288 288
 		// FIXME this should be a method in the user management instead
289
-		$this->logger->debug('shareWith before, ' . $uid, ['app' => $this->appName]);
289
+		$this->logger->debug('shareWith before, '.$uid, ['app' => $this->appName]);
290 290
 		\OCP\Util::emitHook(
291 291
 			'\OCA\Files_Sharing\API\Server2Server',
292 292
 			'preLoginNameUsedAsUserName',
293 293
 			['uid' => &$uid]
294 294
 		);
295
-		$this->logger->debug('shareWith after, ' . $uid, ['app' => $this->appName]);
295
+		$this->logger->debug('shareWith after, '.$uid, ['app' => $this->appName]);
296 296
 
297 297
 		return $uid;
298 298
 	}
Please login to merge, or discard this patch.
apps/files_versions/lib/Storage.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 
59 59
 class Storage {
60 60
 
61
-	const DEFAULTENABLED=true;
62
-	const DEFAULTMAXSIZE=50; // unit: percentage; 50% of available disk space/quota
61
+	const DEFAULTENABLED = true;
62
+	const DEFAULTMAXSIZE = 50; // unit: percentage; 50% of available disk space/quota
63 63
 	const VERSIONS_ROOT = 'files_versions/';
64 64
 
65 65
 	const DELETE_TRIGGER_MASTER_REMOVED = 0;
@@ -73,17 +73,17 @@  discard block
 block discarded – undo
73 73
 
74 74
 	private static $max_versions_per_interval = [
75 75
 		//first 10sec, one version every 2sec
76
-		1 => ['intervalEndsAfter' => 10,      'step' => 2],
76
+		1 => ['intervalEndsAfter' => 10, 'step' => 2],
77 77
 		//next minute, one version every 10sec
78
-		2 => ['intervalEndsAfter' => 60,      'step' => 10],
78
+		2 => ['intervalEndsAfter' => 60, 'step' => 10],
79 79
 		//next hour, one version every minute
80
-		3 => ['intervalEndsAfter' => 3600,    'step' => 60],
80
+		3 => ['intervalEndsAfter' => 3600, 'step' => 60],
81 81
 		//next 24h, one version every hour
82
-		4 => ['intervalEndsAfter' => 86400,   'step' => 3600],
82
+		4 => ['intervalEndsAfter' => 86400, 'step' => 3600],
83 83
 		//next 30days, one version per day
84 84
 		5 => ['intervalEndsAfter' => 2592000, 'step' => 86400],
85 85
 		//until the end one version per week
86
-		6 => ['intervalEndsAfter' => -1,      'step' => 604800],
86
+		6 => ['intervalEndsAfter' => -1, 'step' => 604800],
87 87
 	];
88 88
 
89 89
 	/** @var \OCA\Files_Versions\AppInfo\Application */
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 			$uid = User::getUser();
108 108
 		}
109 109
 		Filesystem::initMountPoints($uid);
110
-		if ( $uid !== User::getUser() ) {
110
+		if ($uid !== User::getUser()) {
111 111
 			$info = Filesystem::getFileInfo($filename);
112 112
 			$ownerView = new View('/'.$uid.'/files');
113 113
 			try {
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 * @return int versions size
158 158
 	 */
159 159
 	private static function getVersionsSize($user) {
160
-		$view = new View('/' . $user);
160
+		$view = new View('/'.$user);
161 161
 		$fileInfo = $view->getFileInfo('/files_versions');
162 162
 		return isset($fileInfo['size']) ? $fileInfo['size'] : 0;
163 163
 	}
@@ -175,13 +175,13 @@  discard block
 block discarded – undo
175 175
 		}
176 176
 
177 177
 		// we only handle existing files
178
-		if (! Filesystem::file_exists($filename) || Filesystem::is_dir($filename)) {
178
+		if (!Filesystem::file_exists($filename) || Filesystem::is_dir($filename)) {
179 179
 			return false;
180 180
 		}
181 181
 
182 182
 		list($uid, $filename) = self::getUidAndFilename($filename);
183 183
 
184
-		$files_view = new View('/'.$uid .'/files');
184
+		$files_view = new View('/'.$uid.'/files');
185 185
 
186 186
 		$eventDispatcher = \OC::$server->getEventDispatcher();
187 187
 		$fileInfo = $files_view->getFileInfo($filename);
@@ -248,14 +248,14 @@  discard block
 block discarded – undo
248 248
 
249 249
 		if (!Filesystem::file_exists($path)) {
250 250
 
251
-			$view = new View('/' . $uid . '/files_versions');
251
+			$view = new View('/'.$uid.'/files_versions');
252 252
 
253 253
 			$versions = self::getVersions($uid, $filename);
254 254
 			if (!empty($versions)) {
255 255
 				foreach ($versions as $v) {
256
-					\OC_Hook::emit('\OCP\Versions', 'preDelete', ['path' => $path . $v['version'], 'trigger' => self::DELETE_TRIGGER_MASTER_REMOVED]);
257
-					self::deleteVersion($view, $filename . '.v' . $v['version']);
258
-					\OC_Hook::emit('\OCP\Versions', 'delete', ['path' => $path . $v['version'], 'trigger' => self::DELETE_TRIGGER_MASTER_REMOVED]);
256
+					\OC_Hook::emit('\OCP\Versions', 'preDelete', ['path' => $path.$v['version'], 'trigger' => self::DELETE_TRIGGER_MASTER_REMOVED]);
257
+					self::deleteVersion($view, $filename.'.v'.$v['version']);
258
+					\OC_Hook::emit('\OCP\Versions', 'delete', ['path' => $path.$v['version'], 'trigger' => self::DELETE_TRIGGER_MASTER_REMOVED]);
259 259
 				}
260 260
 			}
261 261
 		}
@@ -289,33 +289,33 @@  discard block
 block discarded – undo
289 289
 		$rootView = new View('');
290 290
 
291 291
 		// did we move a directory ?
292
-		if ($rootView->is_dir('/' . $targetOwner . '/files/' . $targetPath)) {
292
+		if ($rootView->is_dir('/'.$targetOwner.'/files/'.$targetPath)) {
293 293
 			// does the directory exists for versions too ?
294
-			if ($rootView->is_dir('/' . $sourceOwner . '/files_versions/' . $sourcePath)) {
294
+			if ($rootView->is_dir('/'.$sourceOwner.'/files_versions/'.$sourcePath)) {
295 295
 				// create missing dirs if necessary
296
-				self::createMissingDirectories($targetPath, new View('/'. $targetOwner));
296
+				self::createMissingDirectories($targetPath, new View('/'.$targetOwner));
297 297
 
298 298
 				// move the directory containing the versions
299 299
 				$rootView->$operation(
300
-					'/' . $sourceOwner . '/files_versions/' . $sourcePath,
301
-					'/' . $targetOwner . '/files_versions/' . $targetPath
300
+					'/'.$sourceOwner.'/files_versions/'.$sourcePath,
301
+					'/'.$targetOwner.'/files_versions/'.$targetPath
302 302
 				);
303 303
 			}
304
-		} else if ($versions = Storage::getVersions($sourceOwner, '/' . $sourcePath)) {
304
+		} else if ($versions = Storage::getVersions($sourceOwner, '/'.$sourcePath)) {
305 305
 			// create missing dirs if necessary
306
-			self::createMissingDirectories($targetPath, new View('/'. $targetOwner));
306
+			self::createMissingDirectories($targetPath, new View('/'.$targetOwner));
307 307
 
308 308
 			foreach ($versions as $v) {
309 309
 				// move each version one by one to the target directory
310 310
 				$rootView->$operation(
311
-					'/' . $sourceOwner . '/files_versions/' . $sourcePath.'.v' . $v['version'],
312
-					'/' . $targetOwner . '/files_versions/' . $targetPath.'.v'.$v['version']
311
+					'/'.$sourceOwner.'/files_versions/'.$sourcePath.'.v'.$v['version'],
312
+					'/'.$targetOwner.'/files_versions/'.$targetPath.'.v'.$v['version']
313 313
 				);
314 314
 			}
315 315
 		}
316 316
 
317 317
 		// if we moved versions directly for a file, schedule expiration check for that file
318
-		if (!$rootView->is_dir('/' . $targetOwner . '/files/' . $targetPath)) {
318
+		if (!$rootView->is_dir('/'.$targetOwner.'/files/'.$targetPath)) {
319 319
 			self::scheduleExpire($targetOwner, $targetPath);
320 320
 		}
321 321
 
@@ -331,13 +331,13 @@  discard block
 block discarded – undo
331 331
 	public static function rollback(string $file, int $revision, IUser $user) {
332 332
 
333 333
 		// add expected leading slash
334
-		$filename = '/' . ltrim($file, '/');
334
+		$filename = '/'.ltrim($file, '/');
335 335
 
336 336
 		// Fetch the userfolder to trigger view hooks
337 337
 		$userFolder = \OC::$server->getUserFolder($user->getUID());
338 338
 
339 339
 		$users_view = new View('/'.$user->getUID());
340
-		$files_view = new View('/'. $user->getUID().'/files');
340
+		$files_view = new View('/'.$user->getUID().'/files');
341 341
 
342 342
 		$versionCreated = false;
343 343
 
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 			$versionCreated = true;
356 356
 		}
357 357
 
358
-		$fileToRestore =  'files_versions' . $filename . '.v' . $revision;
358
+		$fileToRestore = 'files_versions'.$filename.'.v'.$revision;
359 359
 
360 360
 		// Restore encrypted version of the old file for the newly restored file
361 361
 		// This has to happen manually here since the file is manually copied below
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 		);
372 372
 
373 373
 		// rollback
374
-		if (self::copyFileContents($users_view, $fileToRestore, 'files' . $filename)) {
374
+		if (self::copyFileContents($users_view, $fileToRestore, 'files'.$filename)) {
375 375
 			$files_view->touch($file, $revision);
376 376
 			Storage::scheduleExpire($user->getUID(), $file);
377 377
 
@@ -444,12 +444,12 @@  discard block
 block discarded – undo
444 444
 			return $versions;
445 445
 		}
446 446
 		// fetch for old versions
447
-		$view = new View('/' . $uid . '/');
447
+		$view = new View('/'.$uid.'/');
448 448
 
449 449
 		$pathinfo = pathinfo($filename);
450 450
 		$versionedFile = $pathinfo['basename'];
451 451
 
452
-		$dir = Filesystem::normalizePath(self::VERSIONS_ROOT . '/' . $pathinfo['dirname']);
452
+		$dir = Filesystem::normalizePath(self::VERSIONS_ROOT.'/'.$pathinfo['dirname']);
453 453
 
454 454
 		$dirContent = false;
455 455
 		if ($view->is_dir($dir)) {
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
 						$pathparts = pathinfo($entryName);
470 470
 						$timestamp = substr($pathparts['extension'], 1);
471 471
 						$filename = $pathparts['filename'];
472
-						$key = $timestamp . '#' . $filename;
472
+						$key = $timestamp.'#'.$filename;
473 473
 						$versions[$key]['version'] = $timestamp;
474 474
 						$versions[$key]['humanReadableTimestamp'] = self::getHumanReadableTimestamp($timestamp);
475 475
 						if (empty($userFullPath)) {
@@ -477,9 +477,9 @@  discard block
 block discarded – undo
477 477
 						} else {
478 478
 							$versions[$key]['preview'] = \OC::$server->getURLGenerator('files_version.Preview.getPreview', ['file' => $userFullPath, 'version' => $timestamp]);
479 479
 						}
480
-						$versions[$key]['path'] = Filesystem::normalizePath($pathinfo['dirname'] . '/' . $filename);
480
+						$versions[$key]['path'] = Filesystem::normalizePath($pathinfo['dirname'].'/'.$filename);
481 481
 						$versions[$key]['name'] = $versionedFile;
482
-						$versions[$key]['size'] = $view->filesize($dir . '/' . $entryName);
482
+						$versions[$key]['size'] = $view->filesize($dir.'/'.$entryName);
483 483
 						$versions[$key]['mimetype'] = \OC::$server->getMimeTypeDetector()->detectPath($versionedFile);
484 484
 					}
485 485
 				}
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 	 * Expire versions that older than max version retention time
498 498
 	 * @param string $uid
499 499
 	 */
500
-	public static function expireOlderThanMaxForUser($uid){
500
+	public static function expireOlderThanMaxForUser($uid) {
501 501
 		$expiration = self::getExpiration();
502 502
 		$threshold = $expiration->getMaxAgeAsTimestamp();
503 503
 		$versions = self::getAllVersions($uid);
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
 
508 508
 		$toDelete = [];
509 509
 		foreach (array_reverse($versions['all']) as $key => $version) {
510
-			if ((int)$version['version'] <$threshold) {
510
+			if ((int) $version['version'] < $threshold) {
511 511
 				$toDelete[$key] = $version;
512 512
 			} else {
513 513
 				//Versions are sorted by time - nothing mo to iterate.
@@ -515,11 +515,11 @@  discard block
 block discarded – undo
515 515
 			}
516 516
 		}
517 517
 
518
-		$view = new View('/' . $uid . '/files_versions');
518
+		$view = new View('/'.$uid.'/files_versions');
519 519
 		if (!empty($toDelete)) {
520 520
 			foreach ($toDelete as $version) {
521 521
 				\OC_Hook::emit('\OCP\Versions', 'preDelete', ['path' => $version['path'].'.v'.$version['version'], 'trigger' => self::DELETE_TRIGGER_RETENTION_CONSTRAINT]);
522
-				self::deleteVersion($view, $version['path'] . '.v' . $version['version']);
522
+				self::deleteVersion($view, $version['path'].'.v'.$version['version']);
523 523
 				\OC_Hook::emit('\OCP\Versions', 'delete', ['path' => $version['path'].'.v'.$version['version'], 'trigger' => self::DELETE_TRIGGER_RETENTION_CONSTRAINT]);
524 524
 			}
525 525
 		}
@@ -535,19 +535,19 @@  discard block
 block discarded – undo
535 535
 		$diff = time() - $timestamp;
536 536
 
537 537
 		if ($diff < 60) { // first minute
538
-			return  $diff . " seconds ago";
538
+			return  $diff." seconds ago";
539 539
 		} elseif ($diff < 3600) { //first hour
540
-			return round($diff / 60) . " minutes ago";
540
+			return round($diff / 60)." minutes ago";
541 541
 		} elseif ($diff < 86400) { // first day
542
-			return round($diff / 3600) . " hours ago";
542
+			return round($diff / 3600)." hours ago";
543 543
 		} elseif ($diff < 604800) { //first week
544
-			return round($diff / 86400) . " days ago";
544
+			return round($diff / 86400)." days ago";
545 545
 		} elseif ($diff < 2419200) { //first month
546
-			return round($diff / 604800) . " weeks ago";
546
+			return round($diff / 604800)." weeks ago";
547 547
 		} elseif ($diff < 29030400) { // first year
548
-			return round($diff / 2419200) . " months ago";
548
+			return round($diff / 2419200)." months ago";
549 549
 		} else {
550
-			return round($diff / 29030400) . " years ago";
550
+			return round($diff / 29030400)." years ago";
551 551
 		}
552 552
 
553 553
 	}
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
 	 * @return array with contains two arrays 'all' which contains all versions sorted by age and 'by_file' which contains all versions sorted by filename
559 559
 	 */
560 560
 	private static function getAllVersions($uid) {
561
-		$view = new View('/' . $uid . '/');
561
+		$view = new View('/'.$uid.'/');
562 562
 		$dirs = [self::VERSIONS_ROOT];
563 563
 		$versions = [];
564 564
 
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
 
569 569
 			foreach ($files as $file) {
570 570
 				$fileData = $file->getData();
571
-				$filePath = $dir . '/' . $fileData['name'];
571
+				$filePath = $dir.'/'.$fileData['name'];
572 572
 				if ($file['type'] === 'dir') {
573 573
 					$dirs[] = $filePath;
574 574
 				} else {
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 					$relPathStart = strlen(self::VERSIONS_ROOT);
577 577
 					$version = substr($filePath, $versionsBegin + 2);
578 578
 					$relpath = substr($filePath, $relPathStart, $versionsBegin - $relPathStart);
579
-					$key = $version . '#' . $relpath;
579
+					$key = $version.'#'.$relpath;
580 580
 					$versions[$key] = ['path' => $relpath, 'timestamp' => $version];
581 581
 				}
582 582
 			}
@@ -617,13 +617,13 @@  discard block
 block discarded – undo
617 617
 			list($toDelete, $size) = self::getAutoExpireList($time, $versions);
618 618
 		} else {
619 619
 			$size = 0;
620
-			$toDelete = [];  // versions we want to delete
620
+			$toDelete = []; // versions we want to delete
621 621
 		}
622 622
 
623 623
 		foreach ($versions as $key => $version) {
624 624
 			if ($expiration->isExpired($version['version'], $quotaExceeded) && !isset($toDelete[$key])) {
625 625
 				$size += $version['size'];
626
-				$toDelete[$key] = $version['path'] . '.v' . $version['version'];
626
+				$toDelete[$key] = $version['path'].'.v'.$version['version'];
627 627
 			}
628 628
 		}
629 629
 
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
 	 */
639 639
 	protected static function getAutoExpireList($time, $versions) {
640 640
 		$size = 0;
641
-		$toDelete = [];  // versions we want to delete
641
+		$toDelete = []; // versions we want to delete
642 642
 
643 643
 		$interval = 1;
644 644
 		$step = Storage::$max_versions_per_interval[$interval]['step'];
@@ -660,9 +660,9 @@  discard block
 block discarded – undo
660 660
 				if ($nextInterval === -1 || $prevTimestamp > $nextInterval) {
661 661
 					if ($version['version'] > $nextVersion) {
662 662
 						//distance between two version too small, mark to delete
663
-						$toDelete[$key] = $version['path'] . '.v' . $version['version'];
663
+						$toDelete[$key] = $version['path'].'.v'.$version['version'];
664 664
 						$size += $version['size'];
665
-						\OC::$server->getLogger()->info('Mark to expire '. $version['path'] .' next version should be ' . $nextVersion . " or smaller. (prevTimestamp: " . $prevTimestamp . "; step: " . $step, ['app' => 'files_versions']);
665
+						\OC::$server->getLogger()->info('Mark to expire '.$version['path'].' next version should be '.$nextVersion." or smaller. (prevTimestamp: ".$prevTimestamp."; step: ".$step, ['app' => 'files_versions']);
666 666
 					} else {
667 667
 						$nextVersion = $version['version'] - $step;
668 668
 						$prevTimestamp = $version['version'];
@@ -717,8 +717,8 @@  discard block
 block discarded – undo
717 717
 			// get available disk space for user
718 718
 			$user = \OC::$server->getUserManager()->get($uid);
719 719
 			if (is_null($user)) {
720
-				\OC::$server->getLogger()->error('Backends provided no user object for ' . $uid, ['app' => 'files_versions']);
721
-				throw new \OC\User\NoUserException('Backends provided no user object for ' . $uid);
720
+				\OC::$server->getLogger()->error('Backends provided no user object for '.$uid, ['app' => 'files_versions']);
721
+				throw new \OC\User\NoUserException('Backends provided no user object for '.$uid);
722 722
 			}
723 723
 
724 724
 			\OC_Util::setupFS($uid);
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
 
736 736
 			$softQuota = true;
737 737
 			$quota = $user->getQuota();
738
-			if ( $quota === null || $quota === 'none' ) {
738
+			if ($quota === null || $quota === 'none') {
739 739
 				$quota = Filesystem::free_space('/');
740 740
 				$softQuota = false;
741 741
 			} else {
@@ -750,7 +750,7 @@  discard block
 block discarded – undo
750 750
 			if ($quota >= 0) {
751 751
 				if ($softQuota) {
752 752
 					$userFolder = \OC::$server->getUserFolder($uid);
753
-					if(is_null($userFolder)) {
753
+					if (is_null($userFolder)) {
754 754
 						$availableSpace = 0;
755 755
 					} else {
756 756
 						$free = $quota - $userFolder->getSize(false); // remaining free space for user
@@ -790,18 +790,18 @@  discard block
 block discarded – undo
790 790
 			}
791 791
 
792 792
 			$logger = \OC::$server->getLogger();
793
-			foreach($toDelete as $key => $path) {
793
+			foreach ($toDelete as $key => $path) {
794 794
 				\OC_Hook::emit('\OCP\Versions', 'preDelete', ['path' => $path, 'trigger' => self::DELETE_TRIGGER_QUOTA_EXCEEDED]);
795 795
 				self::deleteVersion($versionsFileview, $path);
796 796
 				\OC_Hook::emit('\OCP\Versions', 'delete', ['path' => $path, 'trigger' => self::DELETE_TRIGGER_QUOTA_EXCEEDED]);
797 797
 				unset($allVersions[$key]); // update array with the versions we keep
798
-				$logger->info('Expire: ' . $path, ['app' => 'files_versions']);
798
+				$logger->info('Expire: '.$path, ['app' => 'files_versions']);
799 799
 			}
800 800
 
801 801
 			// Check if enough space is available after versions are rearranged.
802 802
 			// If not we delete the oldest versions until we meet the size limit for versions,
803 803
 			// but always keep the two latest versions
804
-			$numOfVersions = count($allVersions) -2 ;
804
+			$numOfVersions = count($allVersions) - 2;
805 805
 			$i = 0;
806 806
 			// sort oldest first and make sure that we start at the first element
807 807
 			ksort($allVersions);
@@ -809,9 +809,9 @@  discard block
 block discarded – undo
809 809
 			while ($availableSpace < 0 && $i < $numOfVersions) {
810 810
 				$version = current($allVersions);
811 811
 				\OC_Hook::emit('\OCP\Versions', 'preDelete', ['path' => $version['path'].'.v'.$version['version'], 'trigger' => self::DELETE_TRIGGER_QUOTA_EXCEEDED]);
812
-				self::deleteVersion($versionsFileview, $version['path'] . '.v' . $version['version']);
812
+				self::deleteVersion($versionsFileview, $version['path'].'.v'.$version['version']);
813 813
 				\OC_Hook::emit('\OCP\Versions', 'delete', ['path' => $version['path'].'.v'.$version['version'], 'trigger' => self::DELETE_TRIGGER_QUOTA_EXCEEDED]);
814
-				\OC::$server->getLogger()->info('running out of space! Delete oldest version: ' . $version['path'].'.v'.$version['version'], ['app' => 'files_versions']);
814
+				\OC::$server->getLogger()->info('running out of space! Delete oldest version: '.$version['path'].'.v'.$version['version'], ['app' => 'files_versions']);
815 815
 				$versionsSize -= $version['size'];
816 816
 				$availableSpace += $version['size'];
817 817
 				next($allVersions);
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
 		$dirParts = explode('/', $dirname);
838 838
 		$dir = "/files_versions";
839 839
 		foreach ($dirParts as $part) {
840
-			$dir = $dir . '/' . $part;
840
+			$dir = $dir.'/'.$part;
841 841
 			if (!$view->file_exists($dir)) {
842 842
 				$view->mkdir($dir);
843 843
 			}
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
 	 * Static workaround
849 849
 	 * @return Expiration
850 850
 	 */
851
-	protected static function getExpiration(){
851
+	protected static function getExpiration() {
852 852
 		if (self::$application === null) {
853 853
 			self::$application = \OC::$server->query(Application::class);
854 854
 		}
Please login to merge, or discard this patch.
apps/files/ajax/list.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 $l = \OC::$server->getL10N('files');
34 34
 
35 35
 // Load the files
36
-$dir = isset($_GET['dir']) ? (string)$_GET['dir'] : '';
36
+$dir = isset($_GET['dir']) ? (string) $_GET['dir'] : '';
37 37
 $dir = \OC\Files\Filesystem::normalizePath($dir);
38 38
 
39 39
 try {
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
 	}
45 45
 
46 46
 	$data = [];
47
-	$baseUrl = \OC::$server->getURLGenerator()->linkTo('files', 'index.php') . '?dir=';
47
+	$baseUrl = \OC::$server->getURLGenerator()->linkTo('files', 'index.php').'?dir=';
48 48
 
49 49
 	$permissions = $dirInfo->getPermissions();
50 50
 
51
-	$sortAttribute = isset($_GET['sort']) ? (string)$_GET['sort'] : 'name';
51
+	$sortAttribute = isset($_GET['sort']) ? (string) $_GET['sort'] : 'name';
52 52
 	$sortDirection = isset($_GET['sortdirection']) ? ($_GET['sortdirection'] === 'desc') : false;
53 53
 	$mimetypeFilters = isset($_GET['mimetypes']) ? json_decode($_GET['mimetypes']) : '';
54 54
 
Please login to merge, or discard this patch.
apps/files/ajax/download.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
32 32
 OCP\User::checkLoggedIn();
33 33
 \OC::$server->getSession()->close();
34 34
 
35
-$files = isset($_GET['files']) ? (string)$_GET['files'] : '';
36
-$dir = isset($_GET['dir']) ? (string)$_GET['dir'] : '';
35
+$files = isset($_GET['files']) ? (string) $_GET['files'] : '';
36
+$dir = isset($_GET['dir']) ? (string) $_GET['dir'] : '';
37 37
 
38 38
 $files_list = json_decode($files);
39 39
 // in case we get only a single file
@@ -46,13 +46,13 @@  discard block
 block discarded – undo
46 46
  * the content must not be longer than 32 characters and must only contain
47 47
  * alphanumeric characters
48 48
  */
49
-if(isset($_GET['downloadStartSecret'])
49
+if (isset($_GET['downloadStartSecret'])
50 50
 	&& !isset($_GET['downloadStartSecret'][32])
51 51
 	&& preg_match('!^[a-zA-Z0-9]+$!', $_GET['downloadStartSecret']) === 1) {
52 52
 	setcookie('ocDownloadStarted', $_GET['downloadStartSecret'], time() + 20, '/');
53 53
 }
54 54
 
55
-$server_params = [ 'head' => \OC::$server->getRequest()->getMethod() === 'HEAD' ];
55
+$server_params = ['head' => \OC::$server->getRequest()->getMethod() === 'HEAD'];
56 56
 
57 57
 /**
58 58
  * Http range requests support
Please login to merge, or discard this patch.
apps/files/lib/Command/Scan.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 		$path = basename($fullPath);
111 111
 
112 112
 		if ($normalizedPath !== $path) {
113
-			$output->writeln("\t<error>Entry \"" . $fullPath . '" will not be accessible due to incompatible encoding</error>');
113
+			$output->writeln("\t<error>Entry \"".$fullPath.'" will not be accessible due to incompatible encoding</error>');
114 114
 		}
115 115
 	}
116 116
 
@@ -120,27 +120,27 @@  discard block
 block discarded – undo
120 120
 
121 121
 		# check on each file/folder if there was a user interrupt (ctrl-c) and throw an exception
122 122
 
123
-		$scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function ($path) use ($output) {
123
+		$scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function($path) use ($output) {
124 124
 			$output->writeln("\tFile\t<info>$path</info>", OutputInterface::VERBOSITY_VERBOSE);
125 125
 			++$this->filesCounter;
126 126
 			$this->abortIfInterrupted();
127 127
 		});
128 128
 
129
-		$scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function ($path) use ($output) {
129
+		$scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function($path) use ($output) {
130 130
 			$output->writeln("\tFolder\t<info>$path</info>", OutputInterface::VERBOSITY_VERBOSE);
131 131
 			++$this->foldersCounter;
132 132
 			$this->abortIfInterrupted();
133 133
 		});
134 134
 
135
-		$scanner->listen('\OC\Files\Utils\Scanner', 'StorageNotAvailable', function (StorageNotAvailableException $e) use ($output) {
136
-			$output->writeln('Error while scanning, storage not available (' . $e->getMessage() . ')', OutputInterface::VERBOSITY_VERBOSE);
135
+		$scanner->listen('\OC\Files\Utils\Scanner', 'StorageNotAvailable', function(StorageNotAvailableException $e) use ($output) {
136
+			$output->writeln('Error while scanning, storage not available ('.$e->getMessage().')', OutputInterface::VERBOSITY_VERBOSE);
137 137
 		});
138 138
 
139
-		$scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function ($path) use ($output) {
139
+		$scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function($path) use ($output) {
140 140
 			$this->checkScanWarning($path, $output);
141 141
 		});
142 142
 
143
-		$scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function ($path) use ($output) {
143
+		$scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function($path) use ($output) {
144 144
 			$this->checkScanWarning($path, $output);
145 145
 		});
146 146
 
@@ -157,10 +157,10 @@  discard block
 block discarded – undo
157 157
 			# exit the function if ctrl-c has been pressed
158 158
 			$output->writeln('Interrupted by user');
159 159
 		} catch (NotFoundException $e) {
160
-			$output->writeln('<error>Path not found: ' . $e->getMessage() . '</error>');
160
+			$output->writeln('<error>Path not found: '.$e->getMessage().'</error>');
161 161
 		} catch (\Exception $e) {
162
-			$output->writeln('<error>Exception during scan: ' . $e->getMessage() . '</error>');
163
-			$output->writeln('<error>' . $e->getTraceAsString() . '</error>');
162
+			$output->writeln('<error>Exception during scan: '.$e->getMessage().'</error>');
163
+			$output->writeln('<error>'.$e->getTraceAsString().'</error>');
164 164
 		}
165 165
 	}
166 166
 
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 	protected function execute(InputInterface $input, OutputInterface $output) {
173 173
 		$inputPath = $input->getOption('path');
174 174
 		if ($inputPath) {
175
-			$inputPath = '/' . trim($inputPath, '/');
175
+			$inputPath = '/'.trim($inputPath, '/');
176 176
 			list (, $user,) = explode('/', $inputPath, 3);
177 177
 			$users = [$user];
178 178
 		} else if ($input->getOption('all')) {
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 			if (is_object($user)) {
201 201
 				$user = $user->getUID();
202 202
 			}
203
-			$path = $inputPath ? $inputPath : '/' . $user;
203
+			$path = $inputPath ? $inputPath : '/'.$user;
204 204
 			++$user_count;
205 205
 			if ($this->userManager->userExists($user)) {
206 206
 				$output->writeln("Starting scan for user $user_count out of $users_total ($user)");
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	protected function formatExecTime() {
298 298
 		$secs = round($this->execTime);
299 299
 		# convert seconds into HH:MM:SS form
300
-		return sprintf('%02d:%02d:%02d', ($secs/3600), ($secs/60%60), $secs%60);
300
+		return sprintf('%02d:%02d:%02d', ($secs / 3600), ($secs / 60 % 60), $secs % 60);
301 301
 	}
302 302
 
303 303
 	/**
Please login to merge, or discard this patch.
apps/files/lib/AppInfo/Application.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
 	public const APP_ID = 'files';
52 52
 
53
-	public function __construct(array $urlParams=[]) {
53
+	public function __construct(array $urlParams = []) {
54 54
 		parent::__construct(self::APP_ID, $urlParams);
55 55
 		$container = $this->getContainer();
56 56
 		$server = $container->getServer();
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 		/**
59 59
 		 * Controllers
60 60
 		 */
61
-		$container->registerService('APIController', function (IContainer $c) use ($server) {
61
+		$container->registerService('APIController', function(IContainer $c) use ($server) {
62 62
 			return new ApiController(
63 63
 				$c->query('AppName'),
64 64
 				$c->query('Request'),
Please login to merge, or discard this patch.
apps/testing/lib/AppInfo/Application.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
 use OCP\AppFramework\App;
28 28
 
29 29
 class Application extends App {
30
-	public function __construct (array $urlParams = []) {
30
+	public function __construct(array $urlParams = []) {
31 31
 		$appName = 'testing';
32 32
 		parent::__construct($appName, $urlParams);
33 33
 
Please login to merge, or discard this patch.
apps/files_external/lib/Lib/Storage/AmazonS3.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 			try {
164 164
 				$result = $this->getConnection()->listObjects([
165 165
 					'Bucket' => $this->bucket,
166
-					'Prefix' => rtrim($path, '/') . '/',
166
+					'Prefix' => rtrim($path, '/').'/',
167 167
 					'MaxKeys' => 1,
168 168
 				]);
169 169
 				$this->directoryCache[$path] = $result['Contents'] || $result['CommonPrefixes'];
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 	 * @param array $params
186 186
 	 */
187 187
 	public function updateLegacyId(array $params) {
188
-		$oldId = 'amazon::' . $params['key'] . md5($params['secret']);
188
+		$oldId = 'amazon::'.$params['key'].md5($params['secret']);
189 189
 
190 190
 		// find by old id or bucket
191 191
 		$stmt = \OC::$server->getDatabaseConnection()->prepare(
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 		try {
238 238
 			$this->getConnection()->putObject([
239 239
 				'Bucket' => $this->bucket,
240
-				'Key' => $path . '/',
240
+				'Key' => $path.'/',
241 241
 				'Body' => '',
242 242
 				'ContentType' => 'httpd/unix-directory'
243 243
 			]);
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 			'Bucket' => $this->bucket
289 289
 		];
290 290
 		if ($path !== null) {
291
-			$params['Prefix'] = $path . '/';
291
+			$params['Prefix'] = $path.'/';
292 292
 		}
293 293
 		try {
294 294
 			$connection = $this->getConnection();
@@ -354,9 +354,9 @@  discard block
 block discarded – undo
354 354
 						$files[] = $file;
355 355
 
356 356
 						// store this information for later usage
357
-						$this->filesCache[$path . $file] = [
357
+						$this->filesCache[$path.$file] = [
358 358
 							'ContentLength' => $object['Size'],
359
-							'LastModified' => (string)$object['LastModified'],
359
+							'LastModified' => (string) $object['LastModified'],
360 360
 						];
361 361
 					}
362 362
 				}
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
 				$tmpFile = \OC::$server->getTempManager()->getTemporaryFile();
516 516
 
517 517
 				$handle = fopen($tmpFile, 'w');
518
-				return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) {
518
+				return CallbackWrapper::wrap($handle, null, null, function() use ($path, $tmpFile) {
519 519
 					$this->writeBack($tmpFile, $path);
520 520
 				});
521 521
 			case 'a':
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 				}
541 541
 
542 542
 				$handle = fopen($tmpFile, $mode);
543
-				return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) {
543
+				return CallbackWrapper::wrap($handle, null, null, function() use ($path, $tmpFile) {
544 544
 					$this->writeBack($tmpFile, $path);
545 545
 				});
546 546
 		}
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
 					'Bucket' => $this->bucket,
569 569
 					'Key' => $this->cleanKey($path),
570 570
 					'Metadata' => $metadata,
571
-					'CopySource' => $this->bucket . '/' . $path,
571
+					'CopySource' => $this->bucket.'/'.$path,
572 572
 					'MetadataDirective' => 'REPLACE',
573 573
 				]);
574 574
 				$this->testTimeout();
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 				$this->getConnection()->copyObject([
603 603
 					'Bucket' => $this->bucket,
604 604
 					'Key' => $this->cleanKey($path2),
605
-					'CopySource' => S3Client::encodeKey($this->bucket . '/' . $path1)
605
+					'CopySource' => S3Client::encodeKey($this->bucket.'/'.$path1)
606 606
 				]);
607 607
 				$this->testTimeout();
608 608
 			} catch (S3Exception $e) {
@@ -615,8 +615,8 @@  discard block
 block discarded – undo
615 615
 			try {
616 616
 				$this->getConnection()->copyObject([
617 617
 					'Bucket' => $this->bucket,
618
-					'Key' => $path2 . '/',
619
-					'CopySource' => S3Client::encodeKey($this->bucket . '/' . $path1 . '/')
618
+					'Key' => $path2.'/',
619
+					'CopySource' => S3Client::encodeKey($this->bucket.'/'.$path1.'/')
620 620
 				]);
621 621
 				$this->testTimeout();
622 622
 			} catch (S3Exception $e) {
@@ -631,8 +631,8 @@  discard block
 block discarded – undo
631 631
 						continue;
632 632
 					}
633 633
 
634
-					$source = $path1 . '/' . $file;
635
-					$target = $path2 . '/' . $file;
634
+					$source = $path1.'/'.$file;
635
+					$target = $path2.'/'.$file;
636 636
 					$this->copy($source, $target);
637 637
 				}
638 638
 			}
Please login to merge, or discard this patch.