Passed
Push — master ( 71cc94...7a2203 )
by Morris
11:44 queued 14s
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
 		$info = self::getAppInfo($app);
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 	 * @param bool $force
237 237
 	 */
238 238
 	public static function registerAutoloading(string $app, string $path, bool $force = false) {
239
-		$key = $app . '-' . $path;
239
+		$key = $app.'-'.$path;
240 240
 		if (!$force && isset(self::$alreadyRegistered[$key])) {
241 241
 			return;
242 242
 		}
@@ -247,17 +247,17 @@  discard block
 block discarded – undo
247 247
 		$appNamespace = \OC\AppFramework\App::buildAppNamespace($app);
248 248
 		\OC::$server->registerNamespace($app, $appNamespace);
249 249
 
250
-		if (file_exists($path . '/composer/autoload.php')) {
251
-			require_once $path . '/composer/autoload.php';
250
+		if (file_exists($path.'/composer/autoload.php')) {
251
+			require_once $path.'/composer/autoload.php';
252 252
 		} else {
253
-			\OC::$composerAutoloader->addPsr4($appNamespace . '\\', $path . '/lib/', true);
253
+			\OC::$composerAutoloader->addPsr4($appNamespace.'\\', $path.'/lib/', true);
254 254
 			// Register on legacy autoloader
255 255
 			\OC::$loader->addValidRoot($path);
256 256
 		}
257 257
 
258 258
 		// Register Test namespace only when testing
259 259
 		if (defined('PHPUNIT_RUN') || defined('CLI_TEST_RUN')) {
260
-			\OC::$composerAutoloader->addPsr4($appNamespace . '\\Tests\\', $path . '/tests/', true);
260
+			\OC::$composerAutoloader->addPsr4($appNamespace.'\\Tests\\', $path.'/tests/', true);
261 261
 		}
262 262
 	}
263 263
 
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 	 */
270 270
 	private static function requireAppFile(string $app) {
271 271
 		// encapsulated here to avoid variable scope conflicts
272
-		require_once $app . '/appinfo/app.php';
272
+		require_once $app.'/appinfo/app.php';
273 273
 	}
274 274
 
275 275
 	/**
@@ -362,8 +362,8 @@  discard block
 block discarded – undo
362 362
 		} else {
363 363
 			$apps = $appManager->getEnabledAppsForUser($user);
364 364
 		}
365
-		$apps = array_filter($apps, function ($app) {
366
-			return $app !== 'files';//we add this manually
365
+		$apps = array_filter($apps, function($app) {
366
+			return $app !== 'files'; //we add this manually
367 367
 		});
368 368
 		sort($apps);
369 369
 		array_unshift($apps, 'files');
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 
464 464
 		$possibleApps = [];
465 465
 		foreach (OC::$APPSROOTS as $dir) {
466
-			if (file_exists($dir['path'] . '/' . $appId)) {
466
+			if (file_exists($dir['path'].'/'.$appId)) {
467 467
 				$possibleApps[] = $dir;
468 468
 			}
469 469
 		}
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 		} else {
478 478
 			$versionToLoad = [];
479 479
 			foreach ($possibleApps as $possibleApp) {
480
-				$version = self::getAppVersionByPath($possibleApp['path'] . '/' . $appId);
480
+				$version = self::getAppVersionByPath($possibleApp['path'].'/'.$appId);
481 481
 				if (empty($versionToLoad) || version_compare($version, $versionToLoad['version'], '>')) {
482 482
 					$versionToLoad = [
483 483
 						'dir' => $possibleApp,
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 		}
506 506
 
507 507
 		if (($dir = self::findAppInDirectories($appId)) != false) {
508
-			return $dir['path'] . '/' . $appId;
508
+			return $dir['path'].'/'.$appId;
509 509
 		}
510 510
 		return false;
511 511
 	}
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 	 */
521 521
 	public static function getAppWebPath(string $appId) {
522 522
 		if (($dir = self::findAppInDirectories($appId)) != false) {
523
-			return OC::$WEBROOT . $dir['url'] . '/' . $appId;
523
+			return OC::$WEBROOT.$dir['url'].'/'.$appId;
524 524
 		}
525 525
 		return false;
526 526
 	}
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 	 * @return string
545 545
 	 */
546 546
 	public static function getAppVersionByPath(string $path): string {
547
-		$infoFile = $path . '/appinfo/info.xml';
547
+		$infoFile = $path.'/appinfo/info.xml';
548 548
 		$appData = \OC::$server->getAppManager()->getAppInfo($infoFile, true);
549 549
 		return isset($appData['version']) ? $appData['version'] : '';
550 550
 	}
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
 	 * @param string $page
645 645
 	 */
646 646
 	public static function registerAdmin(string $app, string $page) {
647
-		self::$adminForms[] = $app . '/' . $page . '.php';
647
+		self::$adminForms[] = $app.'/'.$page.'.php';
648 648
 	}
649 649
 
650 650
 	/**
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 	 * @param string $page
654 654
 	 */
655 655
 	public static function registerPersonal(string $app, string $page) {
656
-		self::$personalForms[] = $app . '/' . $page . '.php';
656
+		self::$personalForms[] = $app.'/'.$page.'.php';
657 657
 	}
658 658
 
659 659
 	/**
@@ -681,14 +681,14 @@  discard block
 block discarded – undo
681 681
 
682 682
 		foreach (OC::$APPSROOTS as $apps_dir) {
683 683
 			if (!is_readable($apps_dir['path'])) {
684
-				\OCP\Util::writeLog('core', 'unable to read app folder : ' . $apps_dir['path'], ILogger::WARN);
684
+				\OCP\Util::writeLog('core', 'unable to read app folder : '.$apps_dir['path'], ILogger::WARN);
685 685
 				continue;
686 686
 			}
687 687
 			$dh = opendir($apps_dir['path']);
688 688
 
689 689
 			if (is_resource($dh)) {
690 690
 				while (($file = readdir($dh)) !== false) {
691
-					if ($file[0] != '.' and is_dir($apps_dir['path'] . '/' . $file) and is_file($apps_dir['path'] . '/' . $file . '/appinfo/info.xml')) {
691
+					if ($file[0] != '.' and is_dir($apps_dir['path'].'/'.$file) and is_file($apps_dir['path'].'/'.$file.'/appinfo/info.xml')) {
692 692
 						$apps[] = $file;
693 693
 					}
694 694
 				}
@@ -722,12 +722,12 @@  discard block
 block discarded – undo
722 722
 			if (array_search($app, $blacklist) === false) {
723 723
 				$info = OC_App::getAppInfo($app, false, $langCode);
724 724
 				if (!is_array($info)) {
725
-					\OCP\Util::writeLog('core', 'Could not read app info file for app "' . $app . '"', ILogger::ERROR);
725
+					\OCP\Util::writeLog('core', 'Could not read app info file for app "'.$app.'"', ILogger::ERROR);
726 726
 					continue;
727 727
 				}
728 728
 
729 729
 				if (!isset($info['name'])) {
730
-					\OCP\Util::writeLog('core', 'App id "' . $app . '" has no name in appinfo', ILogger::ERROR);
730
+					\OCP\Util::writeLog('core', 'App id "'.$app.'" has no name in appinfo', ILogger::ERROR);
731 731
 					continue;
732 732
 				}
733 733
 
@@ -759,12 +759,12 @@  discard block
 block discarded – undo
759 759
 
760 760
 				$appPath = self::getAppPath($app);
761 761
 				if ($appPath !== false) {
762
-					$appIcon = $appPath . '/img/' . $app . '.svg';
762
+					$appIcon = $appPath.'/img/'.$app.'.svg';
763 763
 					if (file_exists($appIcon)) {
764
-						$info['preview'] = $urlGenerator->imagePath($app, $app . '.svg');
764
+						$info['preview'] = $urlGenerator->imagePath($app, $app.'.svg');
765 765
 						$info['previewAsIcon'] = true;
766 766
 					} else {
767
-						$appIcon = $appPath . '/img/app.svg';
767
+						$appIcon = $appPath.'/img/app.svg';
768 768
 						if (file_exists($appIcon)) {
769 769
 							$info['preview'] = $urlGenerator->imagePath($app, 'app.svg');
770 770
 							$info['previewAsIcon'] = true;
@@ -909,8 +909,8 @@  discard block
 block discarded – undo
909 909
 		self::registerAutoloading($appId, $appPath, true);
910 910
 		self::executeRepairSteps($appId, $appData['repair-steps']['pre-migration']);
911 911
 
912
-		if (file_exists($appPath . '/appinfo/database.xml')) {
913
-			OC_DB::updateDbFromStructure($appPath . '/appinfo/database.xml');
912
+		if (file_exists($appPath.'/appinfo/database.xml')) {
913
+			OC_DB::updateDbFromStructure($appPath.'/appinfo/database.xml');
914 914
 		} else {
915 915
 			$ms = new MigrationService($appId, \OC::$server->getDatabaseConnection());
916 916
 			$ms->migrate();
@@ -923,9 +923,9 @@  discard block
 block discarded – undo
923 923
 		\OC::$server->getAppManager()->getAppVersion($appId, false);
924 924
 
925 925
 		// run upgrade code
926
-		if (file_exists($appPath . '/appinfo/update.php')) {
926
+		if (file_exists($appPath.'/appinfo/update.php')) {
927 927
 			self::loadApp($appId);
928
-			include $appPath . '/appinfo/update.php';
928
+			include $appPath.'/appinfo/update.php';
929 929
 		}
930 930
 		self::setupBackgroundJobs($appData['background-jobs']);
931 931
 
@@ -936,10 +936,10 @@  discard block
 block discarded – undo
936 936
 			\OC::$server->getConfig()->deleteAppValue($appId, 'ocsid');
937 937
 		}
938 938
 		foreach ($appData['remote'] as $name => $path) {
939
-			\OC::$server->getConfig()->setAppValue('core', 'remote_' . $name, $appId . '/' . $path);
939
+			\OC::$server->getConfig()->setAppValue('core', 'remote_'.$name, $appId.'/'.$path);
940 940
 		}
941 941
 		foreach ($appData['public'] as $name => $path) {
942
-			\OC::$server->getConfig()->setAppValue('core', 'public_' . $name, $appId . '/' . $path);
942
+			\OC::$server->getConfig()->setAppValue('core', 'public_'.$name, $appId.'/'.$path);
943 943
 		}
944 944
 
945 945
 		self::setAppTypes($appId);
@@ -1009,17 +1009,17 @@  discard block
 block discarded – undo
1009 1009
 	public static function getStorage(string $appId) {
1010 1010
 		if (\OC::$server->getAppManager()->isEnabledForUser($appId)) { //sanity check
1011 1011
 			if (\OC::$server->getUserSession()->isLoggedIn()) {
1012
-				$view = new \OC\Files\View('/' . OC_User::getUser());
1012
+				$view = new \OC\Files\View('/'.OC_User::getUser());
1013 1013
 				if (!$view->file_exists($appId)) {
1014 1014
 					$view->mkdir($appId);
1015 1015
 				}
1016
-				return new \OC\Files\View('/' . OC_User::getUser() . '/' . $appId);
1016
+				return new \OC\Files\View('/'.OC_User::getUser().'/'.$appId);
1017 1017
 			} else {
1018
-				\OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ', user not logged in', ILogger::ERROR);
1018
+				\OCP\Util::writeLog('core', 'Can\'t get app storage, app '.$appId.', user not logged in', ILogger::ERROR);
1019 1019
 				return false;
1020 1020
 			}
1021 1021
 		} else {
1022
-			\OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ' not enabled', ILogger::ERROR);
1022
+			\OCP\Util::writeLog('core', 'Can\'t get app storage, app '.$appId.' not enabled', ILogger::ERROR);
1023 1023
 			return false;
1024 1024
 		}
1025 1025
 	}
@@ -1056,9 +1056,9 @@  discard block
 block discarded – undo
1056 1056
 
1057 1057
 				if ($attributeLang === $similarLang) {
1058 1058
 					$similarLangFallback = $option['@value'];
1059
-				} elseif (strpos($attributeLang, $similarLang . '_') === 0) {
1059
+				} elseif (strpos($attributeLang, $similarLang.'_') === 0) {
1060 1060
 					if ($similarLangFallback === false) {
1061
-						$similarLangFallback =  $option['@value'];
1061
+						$similarLangFallback = $option['@value'];
1062 1062
 					}
1063 1063
 				}
1064 1064
 			} else {
Please login to merge, or discard this patch.