Completed
Push — master ( 970e11...6694cf )
by
unknown
20:31 queued 14s
created
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
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 		$exts = [''];
133 133
 		$check_fn = 'is_executable';
134 134
 		// Default check will be done with $path directories :
135
-		$dirs = explode(PATH_SEPARATOR, (string)$path);
135
+		$dirs = explode(PATH_SEPARATOR, (string) $path);
136 136
 		// WARNING : We have to check if open_basedir is enabled :
137 137
 		$obd = OC::$server->get(IniGetWrapper::class)->getString('open_basedir');
138 138
 		if ($obd != 'none') {
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 		}
146 146
 		foreach ($dirs as $dir) {
147 147
 			foreach ($exts as $ext) {
148
-				if ($check_fn("$dir/$name" . $ext)) {
148
+				if ($check_fn("$dir/$name".$ext)) {
149 149
 					return true;
150 150
 				}
151 151
 			}
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 			$ext = '';
218 218
 		}
219 219
 
220
-		$newpath = $path . '/' . $filename;
220
+		$newpath = $path.'/'.$filename;
221 221
 		if ($view->file_exists($newpath)) {
222 222
 			if (preg_match_all('/\((\d+)\)/', $name, $matches, PREG_OFFSET_CAPTURE)) {
223 223
 				//Replace the last "(number)" with "(number+1)"
@@ -233,11 +233,11 @@  discard block
 block discarded – undo
233 233
 			do {
234 234
 				if ($offset) {
235 235
 					//Replace the last "(number)" with "(number+1)"
236
-					$newname = substr_replace($name, '(' . $counter . ')', $offset, $match_length);
236
+					$newname = substr_replace($name, '('.$counter.')', $offset, $match_length);
237 237
 				} else {
238
-					$newname = $name . ' (' . $counter . ')';
238
+					$newname = $name.' ('.$counter.')';
239 239
 				}
240
-				$newpath = $path . '/' . $newname . $ext;
240
+				$newpath = $path.'/'.$newname.$ext;
241 241
 				$counter++;
242 242
 			} while ($view->file_exists($newpath));
243 243
 		}
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 		}
356 356
 		$fullPath = Filesystem::normalizePath($view->getAbsolutePath($path));
357 357
 
358
-		$cacheKey = $fullPath . '::' . ($includeMountPoints ? 'include' : 'exclude');
358
+		$cacheKey = $fullPath.'::'.($includeMountPoints ? 'include' : 'exclude');
359 359
 		if ($useCache) {
360 360
 			$cached = $memcache->get($cacheKey);
361 361
 			if ($cached) {
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 
467 467
 		if ($isRemoteShare === false && $ownerId !== false && $path === '/') {
468 468
 			// If path is root, store this as last known quota usage for this user
469
-			\OCP\Server::get(\OCP\IConfig::class)->setUserValue($ownerId, 'files', 'lastSeenQuotaUsage', (string)$relative);
469
+			\OCP\Server::get(\OCP\IConfig::class)->setUserValue($ownerId, 'files', 'lastSeenQuotaUsage', (string) $relative);
470 470
 		}
471 471
 
472 472
 		$memcache->set($cacheKey, $info, 5 * 60);
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 	 * @psalm-suppress LessSpecificReturnStatement Legacy code outputs weird types - manually validated that they are correct
481 481
 	 * @return StorageInfo
482 482
 	 */
483
-	private static function getGlobalStorageInfo(int|float $quota, IUser $user, IMountPoint $mount): array {
483
+	private static function getGlobalStorageInfo(int | float $quota, IUser $user, IMountPoint $mount): array {
484 484
 		$rootInfo = \OC\Files\Filesystem::getFileInfo('', 'ext');
485 485
 		/** @var int|float $used */
486 486
 		$used = $rootInfo['size'];
@@ -525,9 +525,9 @@  discard block
 block discarded – undo
525 525
 		/** @var ICacheFactory $cacheFactory */
526 526
 		$cacheFactory = \OC::$server->get(ICacheFactory::class);
527 527
 		$memcache = $cacheFactory->createLocal('storage_info');
528
-		$cacheKeyPrefix = Filesystem::normalizePath($absolutePath) . '::';
529
-		$memcache->remove($cacheKeyPrefix . 'include');
530
-		$memcache->remove($cacheKeyPrefix . 'exclude');
528
+		$cacheKeyPrefix = Filesystem::normalizePath($absolutePath).'::';
529
+		$memcache->remove($cacheKeyPrefix.'include');
530
+		$memcache->remove($cacheKeyPrefix.'exclude');
531 531
 	}
532 532
 
533 533
 	/**
Please login to merge, or discard this patch.
lib/private/Installer.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
 			throw new \Exception('App not found in any app directory');
61 61
 		}
62 62
 
63
-		$basedir = $app['path'] . '/' . $appId;
63
+		$basedir = $app['path'].'/'.$appId;
64 64
 
65
-		if (is_file($basedir . '/appinfo/database.xml')) {
66
-			throw new \Exception('The appinfo/database.xml file is not longer supported. Used in ' . $appId);
65
+		if (is_file($basedir.'/appinfo/database.xml')) {
66
+			throw new \Exception('The appinfo/database.xml file is not longer supported. Used in '.$appId);
67 67
 		}
68 68
 
69 69
 		$l = \OCP\Util::getL10N('core');
70
-		$info = \OCP\Server::get(IAppManager::class)->getAppInfoByPath($basedir . '/appinfo/info.xml', $l->getLanguageCode());
70
+		$info = \OCP\Server::get(IAppManager::class)->getAppInfoByPath($basedir.'/appinfo/info.xml', $l->getLanguageCode());
71 71
 
72 72
 		if (!is_array($info)) {
73 73
 			throw new \Exception(
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 		\OC_App::setupBackgroundJobs($info['background-jobs']);
114 114
 
115 115
 		//run appinfo/install.php
116
-		self::includeAppScript($basedir . '/appinfo/install.php');
116
+		self::includeAppScript($basedir.'/appinfo/install.php');
117 117
 
118 118
 		OC_App::executeRepairSteps($appId, $info['repair-steps']['install']);
119 119
 
@@ -124,10 +124,10 @@  discard block
 block discarded – undo
124 124
 
125 125
 		//set remote/public handlers
126 126
 		foreach ($info['remote'] as $name => $path) {
127
-			$config->setAppValue('core', 'remote_' . $name, $info['id'] . '/' . $path);
127
+			$config->setAppValue('core', 'remote_'.$name, $info['id'].'/'.$path);
128 128
 		}
129 129
 		foreach ($info['public'] as $name => $path) {
130
-			$config->setAppValue('core', 'public_' . $name, $info['id'] . '/' . $path);
130
+			$config->setAppValue('core', 'public_'.$name, $info['id'].'/'.$path);
131 131
 		}
132 132
 
133 133
 		OC_App::setAppTypes($info['id']);
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 			if ($app['id'] === $appId) {
185 185
 				// Load the certificate
186 186
 				$certificate = new X509();
187
-				$rootCrt = file_get_contents(__DIR__ . '/../../resources/codesigning/root.crt');
187
+				$rootCrt = file_get_contents(__DIR__.'/../../resources/codesigning/root.crt');
188 188
 				$rootCrts = $this->splitCerts($rootCrt);
189 189
 				foreach ($rootCrts as $rootCrt) {
190 190
 					$certificate->loadCA($rootCrt);
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 				foreach ($rootCrts as $rootCrt) {
197 197
 					$crl->loadCA($rootCrt);
198 198
 				}
199
-				$crl->loadCRL(file_get_contents(__DIR__ . '/../../resources/codesigning/root.crl'));
199
+				$crl->loadCRL(file_get_contents(__DIR__.'/../../resources/codesigning/root.crl'));
200 200
 				if ($crl->validateSignature() !== true) {
201 201
 					throw new \Exception('Could not validate CRL signature');
202 202
 				}
@@ -264,11 +264,11 @@  discard block
 block discarded – undo
264 264
 
265 265
 					$archive = new TAR($tempFile);
266 266
 					if (!$archive->extract($extractDir)) {
267
-						$errorMessage = 'Could not extract app ' . $appId;
267
+						$errorMessage = 'Could not extract app '.$appId;
268 268
 
269 269
 						$archiveError = $archive->getError();
270 270
 						if ($archiveError instanceof \PEAR_Error) {
271
-							$errorMessage .= ': ' . $archiveError->getMessage();
271
+							$errorMessage .= ': '.$archiveError->getMessage();
272 272
 						}
273 273
 
274 274
 						throw new \Exception($errorMessage);
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 					}
297 297
 
298 298
 					// Check if appinfo/info.xml has the same app ID as well
299
-					$xml = simplexml_load_string(file_get_contents($extractDir . '/' . $folders[0] . '/appinfo/info.xml'));
299
+					$xml = simplexml_load_string(file_get_contents($extractDir.'/'.$folders[0].'/appinfo/info.xml'));
300 300
 
301 301
 					if ($xml === false) {
302 302
 						throw new \Exception(
@@ -307,19 +307,19 @@  discard block
 block discarded – undo
307 307
 						);
308 308
 					}
309 309
 
310
-					if ((string)$xml->id !== $appId) {
310
+					if ((string) $xml->id !== $appId) {
311 311
 						throw new \Exception(
312 312
 							sprintf(
313 313
 								'App for id %s has a wrong app ID in info.xml: %s',
314 314
 								$appId,
315
-								(string)$xml->id
315
+								(string) $xml->id
316 316
 							)
317 317
 						);
318 318
 					}
319 319
 
320 320
 					// Check if the version is lower than before
321 321
 					$currentVersion = \OCP\Server::get(IAppManager::class)->getAppVersion($appId, true);
322
-					$newVersion = (string)$xml->version;
322
+					$newVersion = (string) $xml->version;
323 323
 					if (version_compare($currentVersion, $newVersion) === 1) {
324 324
 						throw new \Exception(
325 325
 							sprintf(
@@ -331,12 +331,12 @@  discard block
 block discarded – undo
331 331
 						);
332 332
 					}
333 333
 
334
-					$baseDir = OC_App::getInstallPath() . '/' . $appId;
334
+					$baseDir = OC_App::getInstallPath().'/'.$appId;
335 335
 					// Remove old app with the ID if existent
336 336
 					Files::rmdirr($baseDir);
337 337
 					// Move to app folder
338 338
 					if (@mkdir($baseDir)) {
339
-						$extractDir .= '/' . $folders[0];
339
+						$extractDir .= '/'.$folders[0];
340 340
 					}
341 341
 					// otherwise we just copy the outer directory
342 342
 					$this->copyRecursive($extractDir, $baseDir);
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 	 * @param bool $allowUnstable
369 369
 	 * @return string|false false or the version number of the update
370 370
 	 */
371
-	public function isUpdateAvailable($appId, $allowUnstable = false): string|false {
371
+	public function isUpdateAvailable($appId, $allowUnstable = false): string | false {
372 372
 		if ($this->isInstanceReadyForUpdates === null) {
373 373
 			$installPath = OC_App::getInstallPath();
374 374
 			if ($installPath === null) {
@@ -419,8 +419,8 @@  discard block
 block discarded – undo
419 419
 		if ($app === false) {
420 420
 			return false;
421 421
 		}
422
-		$basedir = $app['path'] . '/' . $appId;
423
-		return file_exists($basedir . '/.git/');
422
+		$basedir = $app['path'].'/'.$appId;
423
+		return file_exists($basedir.'/.git/');
424 424
 	}
425 425
 
426 426
 	/**
@@ -458,11 +458,11 @@  discard block
 block discarded – undo
458 458
 			if (\OCP\Server::get(IAppManager::class)->isShipped($appId)) {
459 459
 				return false;
460 460
 			}
461
-			$appDir = OC_App::getInstallPath() . '/' . $appId;
461
+			$appDir = OC_App::getInstallPath().'/'.$appId;
462 462
 			Files::rmdirr($appDir);
463 463
 			return true;
464 464
 		} else {
465
-			$this->logger->error('can\'t remove app ' . $appId . '. It is not installed.');
465
+			$this->logger->error('can\'t remove app '.$appId.'. It is not installed.');
466 466
 
467 467
 			return false;
468 468
 		}
@@ -506,8 +506,8 @@  discard block
 block discarded – undo
506 506
 		foreach (\OC::$APPSROOTS as $app_dir) {
507 507
 			if ($dir = opendir($app_dir['path'])) {
508 508
 				while (false !== ($filename = readdir($dir))) {
509
-					if ($filename[0] !== '.' and is_dir($app_dir['path'] . "/$filename")) {
510
-						if (file_exists($app_dir['path'] . "/$filename/appinfo/info.xml")) {
509
+					if ($filename[0] !== '.' and is_dir($app_dir['path']."/$filename")) {
510
+						if (file_exists($app_dir['path']."/$filename/appinfo/info.xml")) {
511 511
 							if ($config->getAppValue($filename, 'installed_version', null) === null) {
512 512
 								$enabled = $appManager->isDefaultEnabled($filename);
513 513
 								if (($enabled || in_array($filename, $appManager->getAlwaysEnabledApps()))
@@ -541,9 +541,9 @@  discard block
 block discarded – undo
541 541
 	/**
542 542
 	 * install an app already placed in the app folder
543 543
 	 */
544
-	public static function installShippedApp(string $app, ?IOutput $output = null): string|false {
544
+	public static function installShippedApp(string $app, ?IOutput $output = null): string | false {
545 545
 		if ($output instanceof IOutput) {
546
-			$output->debug('Installing ' . $app);
546
+			$output->debug('Installing '.$app);
547 547
 		}
548 548
 
549 549
 		$appManager = \OCP\Server::get(IAppManager::class);
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
 			return false;
568 568
 		}
569 569
 		if ($output instanceof IOutput) {
570
-			$output->debug('Registering tasks of ' . $app);
570
+			$output->debug('Registering tasks of '.$app);
571 571
 		}
572 572
 		\OC_App::setupBackgroundJobs($info['background-jobs']);
573 573
 
@@ -580,10 +580,10 @@  discard block
 block discarded – undo
580 580
 
581 581
 		//set remote/public handlers
582 582
 		foreach ($info['remote'] as $name => $path) {
583
-			$config->setAppValue('core', 'remote_' . $name, $app . '/' . $path);
583
+			$config->setAppValue('core', 'remote_'.$name, $app.'/'.$path);
584 584
 		}
585 585
 		foreach ($info['public'] as $name => $path) {
586
-			$config->setAppValue('core', 'public_' . $name, $app . '/' . $path);
586
+			$config->setAppValue('core', 'public_'.$name, $app.'/'.$path);
587 587
 		}
588 588
 
589 589
 		OC_App::setAppTypes($info['id']);
Please login to merge, or discard this patch.