Passed
Push — master ( d1b03f...c1183f )
by Christoph
11:01 queued 11s
created
lib/private/legacy/OC_App.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -152,8 +152,8 @@  discard block
 block discarded – undo
152 152
 		/** @var \OC\AppFramework\Bootstrap\Coordinator $coordinator */
153 153
 		$coordinator = \OC::$server->query(\OC\AppFramework\Bootstrap\Coordinator::class);
154 154
 		$coordinator->bootApp($app);
155
-		if (is_file($appPath . '/appinfo/app.php')) {
156
-			\OC::$server->getEventLogger()->start('load_app_' . $app, 'Load app: ' . $app);
155
+		if (is_file($appPath.'/appinfo/app.php')) {
156
+			\OC::$server->getEventLogger()->start('load_app_'.$app, 'Load app: '.$app);
157 157
 			try {
158 158
 				self::requireAppFile($app);
159 159
 			} catch (Throwable $ex) {
@@ -162,18 +162,18 @@  discard block
 block discarded – undo
162 162
 				}
163 163
 				if (!\OC::$server->getAppManager()->isShipped($app) && !self::isType($app, ['authentication'])) {
164 164
 					\OC::$server->getLogger()->logException($ex, [
165
-						'message' => "App $app threw an error during app.php load and will be disabled: " . $ex->getMessage(),
165
+						'message' => "App $app threw an error during app.php load and will be disabled: ".$ex->getMessage(),
166 166
 					]);
167 167
 
168 168
 					// Only disable apps which are not shipped and that are not authentication apps
169 169
 					\OC::$server->getAppManager()->disableApp($app, true);
170 170
 				} else {
171 171
 					\OC::$server->getLogger()->logException($ex, [
172
-						'message' => "App $app threw an error during app.php load: " . $ex->getMessage(),
172
+						'message' => "App $app threw an error during app.php load: ".$ex->getMessage(),
173 173
 					]);
174 174
 				}
175 175
 			}
176
-			\OC::$server->getEventLogger()->end('load_app_' . $app);
176
+			\OC::$server->getEventLogger()->end('load_app_'.$app);
177 177
 		}
178 178
 
179 179
 		$info = self::getAppInfo($app);
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	 * @param bool $force
240 240
 	 */
241 241
 	public static function registerAutoloading(string $app, string $path, bool $force = false) {
242
-		$key = $app . '-' . $path;
242
+		$key = $app.'-'.$path;
243 243
 		if (!$force && isset(self::$alreadyRegistered[$key])) {
244 244
 			return;
245 245
 		}
@@ -250,17 +250,17 @@  discard block
 block discarded – undo
250 250
 		$appNamespace = \OC\AppFramework\App::buildAppNamespace($app);
251 251
 		\OC::$server->registerNamespace($app, $appNamespace);
252 252
 
253
-		if (file_exists($path . '/composer/autoload.php')) {
254
-			require_once $path . '/composer/autoload.php';
253
+		if (file_exists($path.'/composer/autoload.php')) {
254
+			require_once $path.'/composer/autoload.php';
255 255
 		} else {
256
-			\OC::$composerAutoloader->addPsr4($appNamespace . '\\', $path . '/lib/', true);
256
+			\OC::$composerAutoloader->addPsr4($appNamespace.'\\', $path.'/lib/', true);
257 257
 			// Register on legacy autoloader
258 258
 			\OC::$loader->addValidRoot($path);
259 259
 		}
260 260
 
261 261
 		// Register Test namespace only when testing
262 262
 		if (defined('PHPUNIT_RUN') || defined('CLI_TEST_RUN')) {
263
-			\OC::$composerAutoloader->addPsr4($appNamespace . '\\Tests\\', $path . '/tests/', true);
263
+			\OC::$composerAutoloader->addPsr4($appNamespace.'\\Tests\\', $path.'/tests/', true);
264 264
 		}
265 265
 	}
266 266
 
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 	 */
273 273
 	private static function requireAppFile(string $app) {
274 274
 		// encapsulated here to avoid variable scope conflicts
275
-		require_once $app . '/appinfo/app.php';
275
+		require_once $app.'/appinfo/app.php';
276 276
 	}
277 277
 
278 278
 	/**
@@ -365,8 +365,8 @@  discard block
 block discarded – undo
365 365
 		} else {
366 366
 			$apps = $appManager->getEnabledAppsForUser($user);
367 367
 		}
368
-		$apps = array_filter($apps, function ($app) {
369
-			return $app !== 'files';//we add this manually
368
+		$apps = array_filter($apps, function($app) {
369
+			return $app !== 'files'; //we add this manually
370 370
 		});
371 371
 		sort($apps);
372 372
 		array_unshift($apps, 'files');
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 
467 467
 		$possibleApps = [];
468 468
 		foreach (OC::$APPSROOTS as $dir) {
469
-			if (file_exists($dir['path'] . '/' . $appId)) {
469
+			if (file_exists($dir['path'].'/'.$appId)) {
470 470
 				$possibleApps[] = $dir;
471 471
 			}
472 472
 		}
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 		} else {
481 481
 			$versionToLoad = [];
482 482
 			foreach ($possibleApps as $possibleApp) {
483
-				$version = self::getAppVersionByPath($possibleApp['path'] . '/' . $appId);
483
+				$version = self::getAppVersionByPath($possibleApp['path'].'/'.$appId);
484 484
 				if (empty($versionToLoad) || version_compare($version, $versionToLoad['version'], '>')) {
485 485
 					$versionToLoad = [
486 486
 						'dir' => $possibleApp,
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 		}
509 509
 
510 510
 		if (($dir = self::findAppInDirectories($appId)) != false) {
511
-			return $dir['path'] . '/' . $appId;
511
+			return $dir['path'].'/'.$appId;
512 512
 		}
513 513
 		return false;
514 514
 	}
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
 	 */
524 524
 	public static function getAppWebPath(string $appId) {
525 525
 		if (($dir = self::findAppInDirectories($appId)) != false) {
526
-			return OC::$WEBROOT . $dir['url'] . '/' . $appId;
526
+			return OC::$WEBROOT.$dir['url'].'/'.$appId;
527 527
 		}
528 528
 		return false;
529 529
 	}
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 	 * @return string
548 548
 	 */
549 549
 	public static function getAppVersionByPath(string $path): string {
550
-		$infoFile = $path . '/appinfo/info.xml';
550
+		$infoFile = $path.'/appinfo/info.xml';
551 551
 		$appData = \OC::$server->getAppManager()->getAppInfo($infoFile, true);
552 552
 		return isset($appData['version']) ? $appData['version'] : '';
553 553
 	}
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
 	 * @param string $page
648 648
 	 */
649 649
 	public static function registerAdmin(string $app, string $page) {
650
-		self::$adminForms[] = $app . '/' . $page . '.php';
650
+		self::$adminForms[] = $app.'/'.$page.'.php';
651 651
 	}
652 652
 
653 653
 	/**
@@ -656,7 +656,7 @@  discard block
 block discarded – undo
656 656
 	 * @param string $page
657 657
 	 */
658 658
 	public static function registerPersonal(string $app, string $page) {
659
-		self::$personalForms[] = $app . '/' . $page . '.php';
659
+		self::$personalForms[] = $app.'/'.$page.'.php';
660 660
 	}
661 661
 
662 662
 	/**
@@ -684,14 +684,14 @@  discard block
 block discarded – undo
684 684
 
685 685
 		foreach (OC::$APPSROOTS as $apps_dir) {
686 686
 			if (!is_readable($apps_dir['path'])) {
687
-				\OCP\Util::writeLog('core', 'unable to read app folder : ' . $apps_dir['path'], ILogger::WARN);
687
+				\OCP\Util::writeLog('core', 'unable to read app folder : '.$apps_dir['path'], ILogger::WARN);
688 688
 				continue;
689 689
 			}
690 690
 			$dh = opendir($apps_dir['path']);
691 691
 
692 692
 			if (is_resource($dh)) {
693 693
 				while (($file = readdir($dh)) !== false) {
694
-					if ($file[0] != '.' and is_dir($apps_dir['path'] . '/' . $file) and is_file($apps_dir['path'] . '/' . $file . '/appinfo/info.xml')) {
694
+					if ($file[0] != '.' and is_dir($apps_dir['path'].'/'.$file) and is_file($apps_dir['path'].'/'.$file.'/appinfo/info.xml')) {
695 695
 						$apps[] = $file;
696 696
 					}
697 697
 				}
@@ -725,12 +725,12 @@  discard block
 block discarded – undo
725 725
 			if (array_search($app, $blacklist) === false) {
726 726
 				$info = OC_App::getAppInfo($app, false, $langCode);
727 727
 				if (!is_array($info)) {
728
-					\OCP\Util::writeLog('core', 'Could not read app info file for app "' . $app . '"', ILogger::ERROR);
728
+					\OCP\Util::writeLog('core', 'Could not read app info file for app "'.$app.'"', ILogger::ERROR);
729 729
 					continue;
730 730
 				}
731 731
 
732 732
 				if (!isset($info['name'])) {
733
-					\OCP\Util::writeLog('core', 'App id "' . $app . '" has no name in appinfo', ILogger::ERROR);
733
+					\OCP\Util::writeLog('core', 'App id "'.$app.'" has no name in appinfo', ILogger::ERROR);
734 734
 					continue;
735 735
 				}
736 736
 
@@ -762,12 +762,12 @@  discard block
 block discarded – undo
762 762
 
763 763
 				$appPath = self::getAppPath($app);
764 764
 				if ($appPath !== false) {
765
-					$appIcon = $appPath . '/img/' . $app . '.svg';
765
+					$appIcon = $appPath.'/img/'.$app.'.svg';
766 766
 					if (file_exists($appIcon)) {
767
-						$info['preview'] = $urlGenerator->imagePath($app, $app . '.svg');
767
+						$info['preview'] = $urlGenerator->imagePath($app, $app.'.svg');
768 768
 						$info['previewAsIcon'] = true;
769 769
 					} else {
770
-						$appIcon = $appPath . '/img/app.svg';
770
+						$appIcon = $appPath.'/img/app.svg';
771 771
 						if (file_exists($appIcon)) {
772 772
 							$info['preview'] = $urlGenerator->imagePath($app, 'app.svg');
773 773
 							$info['previewAsIcon'] = true;
@@ -912,8 +912,8 @@  discard block
 block discarded – undo
912 912
 		self::registerAutoloading($appId, $appPath, true);
913 913
 		self::executeRepairSteps($appId, $appData['repair-steps']['pre-migration']);
914 914
 
915
-		if (file_exists($appPath . '/appinfo/database.xml')) {
916
-			OC_DB::updateDbFromStructure($appPath . '/appinfo/database.xml');
915
+		if (file_exists($appPath.'/appinfo/database.xml')) {
916
+			OC_DB::updateDbFromStructure($appPath.'/appinfo/database.xml');
917 917
 		} else {
918 918
 			$ms = new MigrationService($appId, \OC::$server->getDatabaseConnection());
919 919
 			$ms->migrate();
@@ -926,9 +926,9 @@  discard block
 block discarded – undo
926 926
 		\OC::$server->getAppManager()->getAppVersion($appId, false);
927 927
 
928 928
 		// run upgrade code
929
-		if (file_exists($appPath . '/appinfo/update.php')) {
929
+		if (file_exists($appPath.'/appinfo/update.php')) {
930 930
 			self::loadApp($appId);
931
-			include $appPath . '/appinfo/update.php';
931
+			include $appPath.'/appinfo/update.php';
932 932
 		}
933 933
 		self::setupBackgroundJobs($appData['background-jobs']);
934 934
 
@@ -939,10 +939,10 @@  discard block
 block discarded – undo
939 939
 			\OC::$server->getConfig()->deleteAppValue($appId, 'ocsid');
940 940
 		}
941 941
 		foreach ($appData['remote'] as $name => $path) {
942
-			\OC::$server->getConfig()->setAppValue('core', 'remote_' . $name, $appId . '/' . $path);
942
+			\OC::$server->getConfig()->setAppValue('core', 'remote_'.$name, $appId.'/'.$path);
943 943
 		}
944 944
 		foreach ($appData['public'] as $name => $path) {
945
-			\OC::$server->getConfig()->setAppValue('core', 'public_' . $name, $appId . '/' . $path);
945
+			\OC::$server->getConfig()->setAppValue('core', 'public_'.$name, $appId.'/'.$path);
946 946
 		}
947 947
 
948 948
 		self::setAppTypes($appId);
@@ -1012,17 +1012,17 @@  discard block
 block discarded – undo
1012 1012
 	public static function getStorage(string $appId) {
1013 1013
 		if (\OC::$server->getAppManager()->isEnabledForUser($appId)) { //sanity check
1014 1014
 			if (\OC::$server->getUserSession()->isLoggedIn()) {
1015
-				$view = new \OC\Files\View('/' . OC_User::getUser());
1015
+				$view = new \OC\Files\View('/'.OC_User::getUser());
1016 1016
 				if (!$view->file_exists($appId)) {
1017 1017
 					$view->mkdir($appId);
1018 1018
 				}
1019
-				return new \OC\Files\View('/' . OC_User::getUser() . '/' . $appId);
1019
+				return new \OC\Files\View('/'.OC_User::getUser().'/'.$appId);
1020 1020
 			} else {
1021
-				\OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ', user not logged in', ILogger::ERROR);
1021
+				\OCP\Util::writeLog('core', 'Can\'t get app storage, app '.$appId.', user not logged in', ILogger::ERROR);
1022 1022
 				return false;
1023 1023
 			}
1024 1024
 		} else {
1025
-			\OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ' not enabled', ILogger::ERROR);
1025
+			\OCP\Util::writeLog('core', 'Can\'t get app storage, app '.$appId.' not enabled', ILogger::ERROR);
1026 1026
 			return false;
1027 1027
 		}
1028 1028
 	}
@@ -1059,9 +1059,9 @@  discard block
 block discarded – undo
1059 1059
 
1060 1060
 				if ($attributeLang === $similarLang) {
1061 1061
 					$similarLangFallback = $option['@value'];
1062
-				} elseif (strpos($attributeLang, $similarLang . '_') === 0) {
1062
+				} elseif (strpos($attributeLang, $similarLang.'_') === 0) {
1063 1063
 					if ($similarLangFallback === false) {
1064
-						$similarLangFallback =  $option['@value'];
1064
+						$similarLangFallback = $option['@value'];
1065 1065
 					}
1066 1066
 				}
1067 1067
 			} else {
Please login to merge, or discard this patch.