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