Passed
Push — master ( aca004...0e42d0 )
by Roeland
41:22 queued 28:35
created
lib/private/legacy/OC_App.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -149,11 +149,11 @@  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')) {
152
+		if (is_file($appPath.'/appinfo/app.php')) {
153 153
 			\OC::$server->getLogger()->debug('/appinfo/app.php is deprecated, use \OCP\AppFramework\Bootstrap\IBootstrap on the application class instead.', [
154 154
 				'app' => $app,
155 155
 			]);
156
-			\OC::$server->getEventLogger()->start('load_app_' . $app, 'Load app: ' . $app);
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
 		/** @var \OC\AppFramework\Bootstrap\Coordinator $coordinator */
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 	 * @param bool $force
244 244
 	 */
245 245
 	public static function registerAutoloading(string $app, string $path, bool $force = false) {
246
-		$key = $app . '-' . $path;
246
+		$key = $app.'-'.$path;
247 247
 		if (!$force && isset(self::$alreadyRegistered[$key])) {
248 248
 			return;
249 249
 		}
@@ -254,17 +254,17 @@  discard block
 block discarded – undo
254 254
 		$appNamespace = \OC\AppFramework\App::buildAppNamespace($app);
255 255
 		\OC::$server->registerNamespace($app, $appNamespace);
256 256
 
257
-		if (file_exists($path . '/composer/autoload.php')) {
258
-			require_once $path . '/composer/autoload.php';
257
+		if (file_exists($path.'/composer/autoload.php')) {
258
+			require_once $path.'/composer/autoload.php';
259 259
 		} else {
260
-			\OC::$composerAutoloader->addPsr4($appNamespace . '\\', $path . '/lib/', true);
260
+			\OC::$composerAutoloader->addPsr4($appNamespace.'\\', $path.'/lib/', true);
261 261
 			// Register on legacy autoloader
262 262
 			\OC::$loader->addValidRoot($path);
263 263
 		}
264 264
 
265 265
 		// Register Test namespace only when testing
266 266
 		if (defined('PHPUNIT_RUN') || defined('CLI_TEST_RUN')) {
267
-			\OC::$composerAutoloader->addPsr4($appNamespace . '\\Tests\\', $path . '/tests/', true);
267
+			\OC::$composerAutoloader->addPsr4($appNamespace.'\\Tests\\', $path.'/tests/', true);
268 268
 		}
269 269
 	}
270 270
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 	 */
277 277
 	private static function requireAppFile(string $app) {
278 278
 		// encapsulated here to avoid variable scope conflicts
279
-		require_once $app . '/appinfo/app.php';
279
+		require_once $app.'/appinfo/app.php';
280 280
 	}
281 281
 
282 282
 	/**
@@ -369,8 +369,8 @@  discard block
 block discarded – undo
369 369
 		} else {
370 370
 			$apps = $appManager->getEnabledAppsForUser($user);
371 371
 		}
372
-		$apps = array_filter($apps, function ($app) {
373
-			return $app !== 'files';//we add this manually
372
+		$apps = array_filter($apps, function($app) {
373
+			return $app !== 'files'; //we add this manually
374 374
 		});
375 375
 		sort($apps);
376 376
 		array_unshift($apps, 'files');
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 
471 471
 		$possibleApps = [];
472 472
 		foreach (OC::$APPSROOTS as $dir) {
473
-			if (file_exists($dir['path'] . '/' . $appId)) {
473
+			if (file_exists($dir['path'].'/'.$appId)) {
474 474
 				$possibleApps[] = $dir;
475 475
 			}
476 476
 		}
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
 		} else {
485 485
 			$versionToLoad = [];
486 486
 			foreach ($possibleApps as $possibleApp) {
487
-				$version = self::getAppVersionByPath($possibleApp['path'] . '/' . $appId);
487
+				$version = self::getAppVersionByPath($possibleApp['path'].'/'.$appId);
488 488
 				if (empty($versionToLoad) || version_compare($version, $versionToLoad['version'], '>')) {
489 489
 					$versionToLoad = [
490 490
 						'dir' => $possibleApp,
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 		}
513 513
 
514 514
 		if (($dir = self::findAppInDirectories($appId)) != false) {
515
-			return $dir['path'] . '/' . $appId;
515
+			return $dir['path'].'/'.$appId;
516 516
 		}
517 517
 		return false;
518 518
 	}
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 	 */
528 528
 	public static function getAppWebPath(string $appId) {
529 529
 		if (($dir = self::findAppInDirectories($appId)) != false) {
530
-			return OC::$WEBROOT . $dir['url'] . '/' . $appId;
530
+			return OC::$WEBROOT.$dir['url'].'/'.$appId;
531 531
 		}
532 532
 		return false;
533 533
 	}
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 	 * @return string
552 552
 	 */
553 553
 	public static function getAppVersionByPath(string $path): string {
554
-		$infoFile = $path . '/appinfo/info.xml';
554
+		$infoFile = $path.'/appinfo/info.xml';
555 555
 		$appData = \OC::$server->getAppManager()->getAppInfo($infoFile, true);
556 556
 		return isset($appData['version']) ? $appData['version'] : '';
557 557
 	}
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
 	 * @param string $page
652 652
 	 */
653 653
 	public static function registerAdmin(string $app, string $page) {
654
-		self::$adminForms[] = $app . '/' . $page . '.php';
654
+		self::$adminForms[] = $app.'/'.$page.'.php';
655 655
 	}
656 656
 
657 657
 	/**
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
 	 * @param string $page
661 661
 	 */
662 662
 	public static function registerPersonal(string $app, string $page) {
663
-		self::$personalForms[] = $app . '/' . $page . '.php';
663
+		self::$personalForms[] = $app.'/'.$page.'.php';
664 664
 	}
665 665
 
666 666
 	/**
@@ -688,14 +688,14 @@  discard block
 block discarded – undo
688 688
 
689 689
 		foreach (OC::$APPSROOTS as $apps_dir) {
690 690
 			if (!is_readable($apps_dir['path'])) {
691
-				\OCP\Util::writeLog('core', 'unable to read app folder : ' . $apps_dir['path'], ILogger::WARN);
691
+				\OCP\Util::writeLog('core', 'unable to read app folder : '.$apps_dir['path'], ILogger::WARN);
692 692
 				continue;
693 693
 			}
694 694
 			$dh = opendir($apps_dir['path']);
695 695
 
696 696
 			if (is_resource($dh)) {
697 697
 				while (($file = readdir($dh)) !== false) {
698
-					if ($file[0] != '.' and is_dir($apps_dir['path'] . '/' . $file) and is_file($apps_dir['path'] . '/' . $file . '/appinfo/info.xml')) {
698
+					if ($file[0] != '.' and is_dir($apps_dir['path'].'/'.$file) and is_file($apps_dir['path'].'/'.$file.'/appinfo/info.xml')) {
699 699
 						$apps[] = $file;
700 700
 					}
701 701
 				}
@@ -729,12 +729,12 @@  discard block
 block discarded – undo
729 729
 			if (array_search($app, $blacklist) === false) {
730 730
 				$info = OC_App::getAppInfo($app, false, $langCode);
731 731
 				if (!is_array($info)) {
732
-					\OCP\Util::writeLog('core', 'Could not read app info file for app "' . $app . '"', ILogger::ERROR);
732
+					\OCP\Util::writeLog('core', 'Could not read app info file for app "'.$app.'"', ILogger::ERROR);
733 733
 					continue;
734 734
 				}
735 735
 
736 736
 				if (!isset($info['name'])) {
737
-					\OCP\Util::writeLog('core', 'App id "' . $app . '" has no name in appinfo', ILogger::ERROR);
737
+					\OCP\Util::writeLog('core', 'App id "'.$app.'" has no name in appinfo', ILogger::ERROR);
738 738
 					continue;
739 739
 				}
740 740
 
@@ -766,12 +766,12 @@  discard block
 block discarded – undo
766 766
 
767 767
 				$appPath = self::getAppPath($app);
768 768
 				if ($appPath !== false) {
769
-					$appIcon = $appPath . '/img/' . $app . '.svg';
769
+					$appIcon = $appPath.'/img/'.$app.'.svg';
770 770
 					if (file_exists($appIcon)) {
771
-						$info['preview'] = $urlGenerator->imagePath($app, $app . '.svg');
771
+						$info['preview'] = $urlGenerator->imagePath($app, $app.'.svg');
772 772
 						$info['previewAsIcon'] = true;
773 773
 					} else {
774
-						$appIcon = $appPath . '/img/app.svg';
774
+						$appIcon = $appPath.'/img/app.svg';
775 775
 						if (file_exists($appIcon)) {
776 776
 							$info['preview'] = $urlGenerator->imagePath($app, 'app.svg');
777 777
 							$info['previewAsIcon'] = true;
@@ -916,8 +916,8 @@  discard block
 block discarded – undo
916 916
 		self::registerAutoloading($appId, $appPath, true);
917 917
 		self::executeRepairSteps($appId, $appData['repair-steps']['pre-migration']);
918 918
 
919
-		if (file_exists($appPath . '/appinfo/database.xml')) {
920
-			OC_DB::updateDbFromStructure($appPath . '/appinfo/database.xml');
919
+		if (file_exists($appPath.'/appinfo/database.xml')) {
920
+			OC_DB::updateDbFromStructure($appPath.'/appinfo/database.xml');
921 921
 		} else {
922 922
 			$ms = new MigrationService($appId, \OC::$server->getDatabaseConnection());
923 923
 			$ms->migrate();
@@ -930,9 +930,9 @@  discard block
 block discarded – undo
930 930
 		\OC::$server->getAppManager()->getAppVersion($appId, false);
931 931
 
932 932
 		// run upgrade code
933
-		if (file_exists($appPath . '/appinfo/update.php')) {
933
+		if (file_exists($appPath.'/appinfo/update.php')) {
934 934
 			self::loadApp($appId);
935
-			include $appPath . '/appinfo/update.php';
935
+			include $appPath.'/appinfo/update.php';
936 936
 		}
937 937
 		self::setupBackgroundJobs($appData['background-jobs']);
938 938
 
@@ -943,10 +943,10 @@  discard block
 block discarded – undo
943 943
 			\OC::$server->getConfig()->deleteAppValue($appId, 'ocsid');
944 944
 		}
945 945
 		foreach ($appData['remote'] as $name => $path) {
946
-			\OC::$server->getConfig()->setAppValue('core', 'remote_' . $name, $appId . '/' . $path);
946
+			\OC::$server->getConfig()->setAppValue('core', 'remote_'.$name, $appId.'/'.$path);
947 947
 		}
948 948
 		foreach ($appData['public'] as $name => $path) {
949
-			\OC::$server->getConfig()->setAppValue('core', 'public_' . $name, $appId . '/' . $path);
949
+			\OC::$server->getConfig()->setAppValue('core', 'public_'.$name, $appId.'/'.$path);
950 950
 		}
951 951
 
952 952
 		self::setAppTypes($appId);
@@ -1016,17 +1016,17 @@  discard block
 block discarded – undo
1016 1016
 	public static function getStorage(string $appId) {
1017 1017
 		if (\OC::$server->getAppManager()->isEnabledForUser($appId)) { //sanity check
1018 1018
 			if (\OC::$server->getUserSession()->isLoggedIn()) {
1019
-				$view = new \OC\Files\View('/' . OC_User::getUser());
1019
+				$view = new \OC\Files\View('/'.OC_User::getUser());
1020 1020
 				if (!$view->file_exists($appId)) {
1021 1021
 					$view->mkdir($appId);
1022 1022
 				}
1023
-				return new \OC\Files\View('/' . OC_User::getUser() . '/' . $appId);
1023
+				return new \OC\Files\View('/'.OC_User::getUser().'/'.$appId);
1024 1024
 			} else {
1025
-				\OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ', user not logged in', ILogger::ERROR);
1025
+				\OCP\Util::writeLog('core', 'Can\'t get app storage, app '.$appId.', user not logged in', ILogger::ERROR);
1026 1026
 				return false;
1027 1027
 			}
1028 1028
 		} else {
1029
-			\OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ' not enabled', ILogger::ERROR);
1029
+			\OCP\Util::writeLog('core', 'Can\'t get app storage, app '.$appId.' not enabled', ILogger::ERROR);
1030 1030
 			return false;
1031 1031
 		}
1032 1032
 	}
@@ -1063,9 +1063,9 @@  discard block
 block discarded – undo
1063 1063
 
1064 1064
 				if ($attributeLang === $similarLang) {
1065 1065
 					$similarLangFallback = $option['@value'];
1066
-				} elseif (strpos($attributeLang, $similarLang . '_') === 0) {
1066
+				} elseif (strpos($attributeLang, $similarLang.'_') === 0) {
1067 1067
 					if ($similarLangFallback === false) {
1068
-						$similarLangFallback =  $option['@value'];
1068
+						$similarLangFallback = $option['@value'];
1069 1069
 					}
1070 1070
 				}
1071 1071
 			} else {
Please login to merge, or discard this patch.