Completed
Pull Request — master (#5833)
by Tobia
14:48
created
settings/ajax/disableapp.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 $lastConfirm = (int) \OC::$server->getSession()->get('last-password-confirm');
28 28
 if ($lastConfirm < (time() - 30 * 60 + 15)) { // allow 15 seconds delay
29 29
 	$l = \OC::$server->getL10N('core');
30
-	OC_JSON::error(array( 'data' => array( 'message' => $l->t('Password confirmation is required'))));
30
+	OC_JSON::error(array('data' => array('message' => $l->t('Password confirmation is required'))));
31 31
 	exit();
32 32
 }
33 33
 
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 	exit;
37 37
 }
38 38
 
39
-$appIds = (array)$_POST['appid'];
40
-foreach($appIds as $appId) {
39
+$appIds = (array) $_POST['appid'];
40
+foreach ($appIds as $appId) {
41 41
 	$appId = OC_App::cleanAppId($appId);
42 42
 	\OC::$server->getAppManager()->disableApp($appId);
43 43
 }
Please login to merge, or discard this patch.
lib/base.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -127,14 +127,14 @@  discard block
 block discarded – undo
127 127
 	 * the app path list is empty or contains an invalid path
128 128
 	 */
129 129
 	public static function initPaths() {
130
-		if(defined('PHPUNIT_CONFIG_DIR')) {
131
-			self::$configDir = OC::$SERVERROOT . '/' . PHPUNIT_CONFIG_DIR . '/';
132
-		} elseif(defined('PHPUNIT_RUN') and PHPUNIT_RUN and is_dir(OC::$SERVERROOT . '/tests/config/')) {
133
-			self::$configDir = OC::$SERVERROOT . '/tests/config/';
134
-		} elseif($dir = getenv('NEXTCLOUD_CONFIG_DIR')) {
135
-			self::$configDir = rtrim($dir, '/') . '/';
130
+		if (defined('PHPUNIT_CONFIG_DIR')) {
131
+			self::$configDir = OC::$SERVERROOT.'/'.PHPUNIT_CONFIG_DIR.'/';
132
+		} elseif (defined('PHPUNIT_RUN') and PHPUNIT_RUN and is_dir(OC::$SERVERROOT.'/tests/config/')) {
133
+			self::$configDir = OC::$SERVERROOT.'/tests/config/';
134
+		} elseif ($dir = getenv('NEXTCLOUD_CONFIG_DIR')) {
135
+			self::$configDir = rtrim($dir, '/').'/';
136 136
 		} else {
137
-			self::$configDir = OC::$SERVERROOT . '/config/';
137
+			self::$configDir = OC::$SERVERROOT.'/config/';
138 138
 		}
139 139
 		self::$config = new \OC\Config(self::$configDir);
140 140
 
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
 			//make sure suburi follows the same rules as scriptName
157 157
 			if (substr(OC::$SUBURI, -9) != 'index.php') {
158 158
 				if (substr(OC::$SUBURI, -1) != '/') {
159
-					OC::$SUBURI = OC::$SUBURI . '/';
159
+					OC::$SUBURI = OC::$SUBURI.'/';
160 160
 				}
161
-				OC::$SUBURI = OC::$SUBURI . 'index.php';
161
+				OC::$SUBURI = OC::$SUBURI.'index.php';
162 162
 			}
163 163
 		}
164 164
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 				OC::$WEBROOT = substr($scriptName, 0, 0 - strlen(OC::$SUBURI));
171 171
 
172 172
 				if (OC::$WEBROOT != '' && OC::$WEBROOT[0] !== '/') {
173
-					OC::$WEBROOT = '/' . OC::$WEBROOT;
173
+					OC::$WEBROOT = '/'.OC::$WEBROOT;
174 174
 				}
175 175
 			} else {
176 176
 				// The scriptName is not ending with OC::$SUBURI
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
 					OC::$APPSROOTS[] = $paths;
200 200
 				}
201 201
 			}
202
-		} elseif (file_exists(OC::$SERVERROOT . '/apps')) {
203
-			OC::$APPSROOTS[] = array('path' => OC::$SERVERROOT . '/apps', 'url' => '/apps', 'writable' => true);
204
-		} elseif (file_exists(OC::$SERVERROOT . '/../apps')) {
202
+		} elseif (file_exists(OC::$SERVERROOT.'/apps')) {
203
+			OC::$APPSROOTS[] = array('path' => OC::$SERVERROOT.'/apps', 'url' => '/apps', 'writable' => true);
204
+		} elseif (file_exists(OC::$SERVERROOT.'/../apps')) {
205 205
 			OC::$APPSROOTS[] = array(
206
-				'path' => rtrim(dirname(OC::$SERVERROOT), '/') . '/apps',
206
+				'path' => rtrim(dirname(OC::$SERVERROOT), '/').'/apps',
207 207
 				'url' => '/apps',
208 208
 				'writable' => true
209 209
 			);
@@ -233,8 +233,8 @@  discard block
 block discarded – undo
233 233
 		$l = \OC::$server->getL10N('lib');
234 234
 
235 235
 		// Create config if it does not already exist
236
-		$configFilePath = self::$configDir .'/config.php';
237
-		if(!file_exists($configFilePath)) {
236
+		$configFilePath = self::$configDir.'/config.php';
237
+		if (!file_exists($configFilePath)) {
238 238
 			@touch($configFilePath);
239 239
 		}
240 240
 
@@ -249,13 +249,13 @@  discard block
 block discarded – undo
249 249
 				echo $l->t('Cannot write into "config" directory!')."\n";
250 250
 				echo $l->t('This can usually be fixed by giving the webserver write access to the config directory')."\n";
251 251
 				echo "\n";
252
-				echo $l->t('See %s', [ $urlGenerator->linkToDocs('admin-dir_permissions') ])."\n";
252
+				echo $l->t('See %s', [$urlGenerator->linkToDocs('admin-dir_permissions')])."\n";
253 253
 				exit;
254 254
 			} else {
255 255
 				OC_Template::printErrorPage(
256 256
 					$l->t('Cannot write into "config" directory!'),
257 257
 					$l->t('This can usually be fixed by giving the webserver write access to the config directory. See %s',
258
-					 [ $urlGenerator->linkToDocs('admin-dir_permissions') ])
258
+					 [$urlGenerator->linkToDocs('admin-dir_permissions')])
259 259
 				);
260 260
 			}
261 261
 		}
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
 			if (OC::$CLI) {
271 271
 				throw new Exception('Not installed');
272 272
 			} else {
273
-				$url = OC::$WEBROOT . '/index.php';
274
-				header('Location: ' . $url);
273
+				$url = OC::$WEBROOT.'/index.php';
274
+				header('Location: '.$url);
275 275
 			}
276 276
 			exit();
277 277
 		}
@@ -377,14 +377,14 @@  discard block
 block discarded – undo
377 377
 		$incompatibleShippedApps = [];
378 378
 		foreach ($incompatibleApps as $appInfo) {
379 379
 			if ($appManager->isShipped($appInfo['id'])) {
380
-				$incompatibleShippedApps[] = $appInfo['name'] . ' (' . $appInfo['id'] . ')';
380
+				$incompatibleShippedApps[] = $appInfo['name'].' ('.$appInfo['id'].')';
381 381
 			}
382 382
 		}
383 383
 
384 384
 		if (!empty($incompatibleShippedApps)) {
385 385
 			$l = \OC::$server->getL10N('core');
386 386
 			$hint = $l->t('The files of the app %$1s were not replaced correctly. Make sure it is a version compatible with the server.', [implode(', ', $incompatibleShippedApps)]);
387
-			throw new \OC\HintException('The files of the app ' . implode(', ', $incompatibleShippedApps) . ' were not replaced correctly. Make sure it is a version compatible with the server.', $hint);
387
+			throw new \OC\HintException('The files of the app '.implode(', ', $incompatibleShippedApps).' were not replaced correctly. Make sure it is a version compatible with the server.', $hint);
388 388
 		}
389 389
 
390 390
 		$tmpl->assign('appsToUpgrade', $appManager->getAppsNeedingUpgrade($ocVersion));
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 	}
396 396
 
397 397
 	public static function initSession() {
398
-		if(self::$server->getRequest()->getServerProtocol() === 'https') {
398
+		if (self::$server->getRequest()->getServerProtocol() === 'https') {
399 399
 			ini_set('session.cookie_secure', true);
400 400
 		}
401 401
 
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 		ini_set('session.cookie_httponly', 'true');
404 404
 
405 405
 		// set the cookie path to the Nextcloud directory
406
-		$cookie_path = OC::$WEBROOT ? : '/';
406
+		$cookie_path = OC::$WEBROOT ?: '/';
407 407
 		ini_set('session.cookie_path', $cookie_path);
408 408
 
409 409
 		// Let the session name be changed in the initSession Hook
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 		// session timeout
438 438
 		if ($session->exists('LAST_ACTIVITY') && (time() - $session->get('LAST_ACTIVITY') > $sessionLifeTime)) {
439 439
 			if (isset($_COOKIE[session_name()])) {
440
-				setcookie(session_name(), null, -1, self::$WEBROOT ? : '/');
440
+				setcookie(session_name(), null, -1, self::$WEBROOT ?: '/');
441 441
 			}
442 442
 			\OC::$server->getUserSession()->logout();
443 443
 		}
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 				continue;
460 460
 			}
461 461
 
462
-			$file = $appPath . '/appinfo/classpath.php';
462
+			$file = $appPath.'/appinfo/classpath.php';
463 463
 			if (file_exists($file)) {
464 464
 				require_once $file;
465 465
 			}
@@ -487,14 +487,14 @@  discard block
 block discarded – undo
487 487
 
488 488
 		// Append __Host to the cookie if it meets the requirements
489 489
 		$cookiePrefix = '';
490
-		if($cookieParams['secure'] === true && $cookieParams['path'] === '/') {
490
+		if ($cookieParams['secure'] === true && $cookieParams['path'] === '/') {
491 491
 			$cookiePrefix = '__Host-';
492 492
 		}
493 493
 
494
-		foreach($policies as $policy) {
494
+		foreach ($policies as $policy) {
495 495
 			header(
496 496
 				sprintf(
497
-					'Set-Cookie: %snc_sameSiteCookie%s=true; path=%s; httponly;' . $secureCookie . 'expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=%s',
497
+					'Set-Cookie: %snc_sameSiteCookie%s=true; path=%s; httponly;'.$secureCookie.'expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=%s',
498 498
 					$cookiePrefix,
499 499
 					$policy,
500 500
 					$cookieParams['path'],
@@ -525,31 +525,31 @@  discard block
 block discarded – undo
525 525
 			// OS X Finder
526 526
 			'/^WebDAVFS/',
527 527
 		];
528
-		if($request->isUserAgent($incompatibleUserAgents)) {
528
+		if ($request->isUserAgent($incompatibleUserAgents)) {
529 529
 			return;
530 530
 		}
531 531
 
532
-		if(count($_COOKIE) > 0) {
532
+		if (count($_COOKIE) > 0) {
533 533
 			$requestUri = $request->getScriptName();
534 534
 			$processingScript = explode('/', $requestUri);
535
-			$processingScript = $processingScript[count($processingScript)-1];
535
+			$processingScript = $processingScript[count($processingScript) - 1];
536 536
 
537 537
 			// index.php routes are handled in the middleware
538
-			if($processingScript === 'index.php') {
538
+			if ($processingScript === 'index.php') {
539 539
 				return;
540 540
 			}
541 541
 
542 542
 			// All other endpoints require the lax and the strict cookie
543
-			if(!$request->passesStrictCookieCheck()) {
543
+			if (!$request->passesStrictCookieCheck()) {
544 544
 				self::sendSameSiteCookies();
545 545
 				// Debug mode gets access to the resources without strict cookie
546 546
 				// due to the fact that the SabreDAV browser also lives there.
547
-				if(!\OC::$server->getConfig()->getSystemValue('debug', false)) {
547
+				if (!\OC::$server->getConfig()->getSystemValue('debug', false)) {
548 548
 					http_response_code(\OCP\AppFramework\Http::STATUS_SERVICE_UNAVAILABLE);
549 549
 					exit();
550 550
 				}
551 551
 			}
552
-		} elseif(!isset($_COOKIE['nc_sameSiteCookielax']) || !isset($_COOKIE['nc_sameSiteCookiestrict'])) {
552
+		} elseif (!isset($_COOKIE['nc_sameSiteCookielax']) || !isset($_COOKIE['nc_sameSiteCookiestrict'])) {
553 553
 			self::sendSameSiteCookies();
554 554
 		}
555 555
 	}
@@ -560,12 +560,12 @@  discard block
 block discarded – undo
560 560
 
561 561
 		// register autoloader
562 562
 		$loaderStart = microtime(true);
563
-		require_once __DIR__ . '/autoloader.php';
563
+		require_once __DIR__.'/autoloader.php';
564 564
 		self::$loader = new \OC\Autoloader([
565
-			OC::$SERVERROOT . '/lib/private/legacy',
565
+			OC::$SERVERROOT.'/lib/private/legacy',
566 566
 		]);
567 567
 		if (defined('PHPUNIT_RUN')) {
568
-			self::$loader->addValidRoot(OC::$SERVERROOT . '/tests');
568
+			self::$loader->addValidRoot(OC::$SERVERROOT.'/tests');
569 569
 		}
570 570
 		spl_autoload_register(array(self::$loader, 'load'));
571 571
 		$loaderEnd = microtime(true);
@@ -573,12 +573,12 @@  discard block
 block discarded – undo
573 573
 		self::$CLI = (php_sapi_name() == 'cli');
574 574
 
575 575
 		// Add default composer PSR-4 autoloader
576
-		self::$composerAutoloader = require_once OC::$SERVERROOT . '/lib/composer/autoload.php';
576
+		self::$composerAutoloader = require_once OC::$SERVERROOT.'/lib/composer/autoload.php';
577 577
 
578 578
 		try {
579 579
 			self::initPaths();
580 580
 			// setup 3rdparty autoloader
581
-			$vendorAutoLoad = OC::$SERVERROOT. '/3rdparty/autoload.php';
581
+			$vendorAutoLoad = OC::$SERVERROOT.'/3rdparty/autoload.php';
582 582
 			if (!file_exists($vendorAutoLoad)) {
583 583
 				throw new \RuntimeException('Composer autoloader not found, unable to continue. Check the folder "3rdparty". Running "git submodule update --init" will initialize the git submodule that handles the subfolder "3rdparty".');
584 584
 			}
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
 			if (!self::$CLI) {
589 589
 				$claimedProtocol = strtoupper($_SERVER['SERVER_PROTOCOL']);
590 590
 				$protocol = in_array($claimedProtocol, ['HTTP/1.0', 'HTTP/1.1', 'HTTP/2']) ? $claimedProtocol : 'HTTP/1.1';
591
-				header($protocol . ' ' . OC_Response::STATUS_SERVICE_UNAVAILABLE);
591
+				header($protocol.' '.OC_Response::STATUS_SERVICE_UNAVAILABLE);
592 592
 			}
593 593
 			// we can't use the template error page here, because this needs the
594 594
 			// DI container which isn't available yet
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
 		@ini_set('display_errors', '0');
607 607
 		@ini_set('log_errors', '1');
608 608
 
609
-		if(!date_default_timezone_set('UTC')) {
609
+		if (!date_default_timezone_set('UTC')) {
610 610
 			throw new \RuntimeException('Could not set timezone to UTC');
611 611
 		}
612 612
 
@@ -660,11 +660,11 @@  discard block
 block discarded – undo
660 660
 					// Convert l10n string into regular string for usage in database
661 661
 					$staticErrors = [];
662 662
 					foreach ($errors as $error) {
663
-						echo $error['error'] . "\n";
664
-						echo $error['hint'] . "\n\n";
663
+						echo $error['error']."\n";
664
+						echo $error['hint']."\n\n";
665 665
 						$staticErrors[] = [
666
-							'error' => (string)$error['error'],
667
-							'hint' => (string)$error['hint'],
666
+							'error' => (string) $error['error'],
667
+							'hint' => (string) $error['hint'],
668 668
 						];
669 669
 					}
670 670
 
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 		}
687 687
 		//try to set the session lifetime
688 688
 		$sessionLifeTime = self::getSessionLifeTime();
689
-		@ini_set('gc_maxlifetime', (string)$sessionLifeTime);
689
+		@ini_set('gc_maxlifetime', (string) $sessionLifeTime);
690 690
 
691 691
 		$systemConfig = \OC::$server->getSystemConfig();
692 692
 
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 		register_shutdown_function(array($lockProvider, 'releaseAll'));
735 735
 
736 736
 		// Check whether the sample configuration has been copied
737
-		if($systemConfig->getValue('copied_sample_config', false)) {
737
+		if ($systemConfig->getValue('copied_sample_config', false)) {
738 738
 			$l = \OC::$server->getL10N('lib');
739 739
 			header('HTTP/1.1 503 Service Temporarily Unavailable');
740 740
 			header('Status: 503 Service Temporarily Unavailable');
@@ -760,11 +760,11 @@  discard block
 block discarded – undo
760 760
 		) {
761 761
 			// Allow access to CSS resources
762 762
 			$isScssRequest = false;
763
-			if(strpos($request->getPathInfo(), '/css/') === 0) {
763
+			if (strpos($request->getPathInfo(), '/css/') === 0) {
764 764
 				$isScssRequest = true;
765 765
 			}
766 766
 
767
-			if(substr($request->getRequestUri(), -11) === '/status.php') {
767
+			if (substr($request->getRequestUri(), -11) === '/status.php') {
768 768
 				OC_Response::setStatus(\OC_Response::STATUS_BAD_REQUEST);
769 769
 				header('Status: 400 Bad Request');
770 770
 				header('Content-Type: application/json');
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
 
805 805
 			// NOTE: This will be replaced to use OCP
806 806
 			$userSession = self::$server->getUserSession();
807
-			$userSession->listen('\OC\User', 'postLogin', function () use ($userSession) {
807
+			$userSession->listen('\OC\User', 'postLogin', function() use ($userSession) {
808 808
 				if (!defined('PHPUNIT_RUN')) {
809 809
 					// reset brute force delay for this IP address and username
810 810
 					$uid = \OC::$server->getUserSession()->getUser()->getUID();
@@ -941,12 +941,12 @@  discard block
 block discarded – undo
941 941
 		// emergency app disabling
942 942
 		if ($requestPath === '/disableapp'
943 943
 			&& $request->getMethod() === 'POST'
944
-			&& ((array)$request->getParam('appid')) !== ''
944
+			&& ((array) $request->getParam('appid')) !== ''
945 945
 		) {
946 946
 			\OCP\JSON::callCheck();
947 947
 			\OCP\JSON::checkAdminUser();
948
-			$appIds = (array)$request->getParam('appid');
949
-			foreach($appIds as $appId) {
948
+			$appIds = (array) $request->getParam('appid');
949
+			foreach ($appIds as $appId) {
950 950
 				$appId = \OC_App::cleanAppId($appId);
951 951
 				\OC::$server->getAppManager()->disableApp($appId);
952 952
 			}
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
 		if (!\OCP\Util::needUpgrade()
962 962
 			&& !$systemConfig->getValue('maintenance', false)) {
963 963
 			// For logged-in users: Load everything
964
-			if(\OC::$server->getUserSession()->isLoggedIn()) {
964
+			if (\OC::$server->getUserSession()->isLoggedIn()) {
965 965
 				OC_App::loadApps();
966 966
 			} else {
967 967
 				// For guests: Load only filesystem and logging
Please login to merge, or discard this patch.
lib/private/Updater.php 1 patch
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -101,43 +101,43 @@  discard block
 block discarded – undo
101 101
 		$this->logAllEvents();
102 102
 
103 103
 		$logLevel = $this->config->getSystemValue('loglevel', Util::WARN);
104
-		$this->emit('\OC\Updater', 'setDebugLogLevel', [ $logLevel, $this->logLevelNames[$logLevel] ]);
104
+		$this->emit('\OC\Updater', 'setDebugLogLevel', [$logLevel, $this->logLevelNames[$logLevel]]);
105 105
 		$this->config->setSystemValue('loglevel', Util::DEBUG);
106 106
 
107 107
 		$wasMaintenanceModeEnabled = $this->config->getSystemValue('maintenance', false);
108 108
 
109
-		if(!$wasMaintenanceModeEnabled) {
109
+		if (!$wasMaintenanceModeEnabled) {
110 110
 			$this->config->setSystemValue('maintenance', true);
111 111
 			$this->emit('\OC\Updater', 'maintenanceEnabled');
112 112
 		}
113 113
 
114 114
 		$installedVersion = $this->config->getSystemValue('version', '0.0.0');
115 115
 		$currentVersion = implode('.', \OCP\Util::getVersion());
116
-		$this->log->debug('starting upgrade from ' . $installedVersion . ' to ' . $currentVersion, array('app' => 'core'));
116
+		$this->log->debug('starting upgrade from '.$installedVersion.' to '.$currentVersion, array('app' => 'core'));
117 117
 
118 118
 		$success = true;
119 119
 		try {
120 120
 			$this->doUpgrade($currentVersion, $installedVersion);
121 121
 		} catch (HintException $exception) {
122 122
 			$this->log->logException($exception, ['app' => 'core']);
123
-			$this->emit('\OC\Updater', 'failure', array($exception->getMessage() . ': ' .$exception->getHint()));
123
+			$this->emit('\OC\Updater', 'failure', array($exception->getMessage().': '.$exception->getHint()));
124 124
 			$success = false;
125 125
 		} catch (\Exception $exception) {
126 126
 			$this->log->logException($exception, ['app' => 'core']);
127
-			$this->emit('\OC\Updater', 'failure', array(get_class($exception) . ': ' .$exception->getMessage()));
127
+			$this->emit('\OC\Updater', 'failure', array(get_class($exception).': '.$exception->getMessage()));
128 128
 			$success = false;
129 129
 		}
130 130
 
131 131
 		$this->emit('\OC\Updater', 'updateEnd', array($success));
132 132
 
133
-		if(!$wasMaintenanceModeEnabled && $success) {
133
+		if (!$wasMaintenanceModeEnabled && $success) {
134 134
 			$this->config->setSystemValue('maintenance', false);
135 135
 			$this->emit('\OC\Updater', 'maintenanceDisabled');
136 136
 		} else {
137 137
 			$this->emit('\OC\Updater', 'maintenanceActive');
138 138
 		}
139 139
 
140
-		$this->emit('\OC\Updater', 'resetLogLevel', [ $logLevel, $this->logLevelNames[$logLevel] ]);
140
+		$this->emit('\OC\Updater', 'resetLogLevel', [$logLevel, $this->logLevelNames[$logLevel]]);
141 141
 		$this->config->setSystemValue('loglevel', $logLevel);
142 142
 		$this->config->setSystemValue('installed', true);
143 143
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 */
152 152
 	private function getAllowedPreviousVersions() {
153 153
 		// this should really be a JSON file
154
-		require \OC::$SERVERROOT . '/version.php';
154
+		require \OC::$SERVERROOT.'/version.php';
155 155
 		/** @var array $OC_VersionCanBeUpgradedFrom */
156 156
 		return $OC_VersionCanBeUpgradedFrom;
157 157
 	}
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	 */
164 164
 	private function getVendor() {
165 165
 		// this should really be a JSON file
166
-		require \OC::$SERVERROOT . '/version.php';
166
+		require \OC::$SERVERROOT.'/version.php';
167 167
 		/** @var string $vendor */
168 168
 		return (string) $vendor;
169 169
 	}
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 	 */
178 178
 	public function isUpgradePossible($oldVersion, $newVersion, array $allowedPreviousVersions) {
179 179
 		$version = explode('.', $oldVersion);
180
-		$majorMinor = $version[0] . '.' . $version[1];
180
+		$majorMinor = $version[0].'.'.$version[1];
181 181
 
182 182
 		$currentVendor = $this->config->getAppValue('core', 'vendor', '');
183 183
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 		// create empty file in data dir, so we can later find
225 225
 		// out that this is indeed an ownCloud data directory
226 226
 		// (in case it didn't exist before)
227
-		file_put_contents($this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/.ocdata', '');
227
+		file_put_contents($this->config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').'/.ocdata', '');
228 228
 
229 229
 		// pre-upgrade repairs
230 230
 		$repair = new Repair(Repair::getBeforeUpgradeRepairSteps(), \OC::$server->getEventDispatcher());
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 		foreach ($errors as $appId => $exception) {
256 256
 			/** @var \Exception $exception */
257 257
 			$this->log->logException($exception, ['app' => $appId]);
258
-			$this->emit('\OC\Updater', 'failure', [$appId . ': ' . $exception->getMessage()]);
258
+			$this->emit('\OC\Updater', 'failure', [$appId.': '.$exception->getMessage()]);
259 259
 		}
260 260
 
261 261
 		// post-upgrade repairs
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 		$this->config->setAppValue('core', 'lastupdatedat', 0);
267 267
 
268 268
 		// Check for code integrity if not disabled
269
-		if(\OC::$server->getIntegrityCodeChecker()->isCodeCheckEnforced()) {
269
+		if (\OC::$server->getIntegrityCodeChecker()->isCodeCheckEnforced()) {
270 270
 			$this->emit('\OC\Updater', 'startCheckCodeIntegrity');
271 271
 			$this->checker->runInstanceVerification();
272 272
 			$this->emit('\OC\Updater', 'finishedCheckCodeIntegrity');
@@ -307,12 +307,12 @@  discard block
 block discarded – undo
307 307
 				 * @link https://github.com/owncloud/core/issues/10980
308 308
 				 * @see \OC_App::updateApp
309 309
 				 */
310
-				if (file_exists(\OC_App::getAppPath($appId) . '/appinfo/preupdate.php')) {
310
+				if (file_exists(\OC_App::getAppPath($appId).'/appinfo/preupdate.php')) {
311 311
 					$this->includePreUpdate($appId);
312 312
 				}
313
-				if (file_exists(\OC_App::getAppPath($appId) . '/appinfo/database.xml')) {
313
+				if (file_exists(\OC_App::getAppPath($appId).'/appinfo/database.xml')) {
314 314
 					$this->emit('\OC\Updater', 'appSimulateUpdate', array($appId));
315
-					\OC_DB::simulateUpdateDbFromStructure(\OC_App::getAppPath($appId) . '/appinfo/database.xml');
315
+					\OC_DB::simulateUpdateDbFromStructure(\OC_App::getAppPath($appId).'/appinfo/database.xml');
316 316
 				}
317 317
 			}
318 318
 		}
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 	 * @param string $appId
326 326
 	 */
327 327
 	private function includePreUpdate($appId) {
328
-		include \OC_App::getAppPath($appId) . '/appinfo/preupdate.php';
328
+		include \OC_App::getAppPath($appId).'/appinfo/preupdate.php';
329 329
 	}
330 330
 
331 331
 	/**
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 		foreach ($apps as $appId) {
344 344
 			$priorityType = false;
345 345
 			foreach ($priorityTypes as $type) {
346
-				if(!isset($stacks[$type])) {
346
+				if (!isset($stacks[$type])) {
347 347
 					$stacks[$type] = array();
348 348
 				}
349 349
 				if (\OC_App::isType($appId, $type)) {
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 					\OC_App::updateApp($appId);
364 364
 					$this->emit('\OC\Updater', 'appUpgrade', [$appId, \OC_App::getAppVersion($appId)]);
365 365
 				}
366
-				if($type !== $pseudoOtherType) {
366
+				if ($type !== $pseudoOtherType) {
367 367
 					// load authentication, filesystem and logging apps after
368 368
 					// upgrading them. Other apps my need to rely on modifying
369 369
 					// user and/or filesystem aspects.
@@ -391,9 +391,9 @@  discard block
 block discarded – undo
391 391
 		foreach ($apps as $app) {
392 392
 			// check if the app is compatible with this version of ownCloud
393 393
 			$info = OC_App::getAppInfo($app);
394
-			if(!OC_App::isAppCompatible($version, $info)) {
394
+			if (!OC_App::isAppCompatible($version, $info)) {
395 395
 				if ($appManager->isShipped($app)) {
396
-					throw new \UnexpectedValueException('The files of the app "' . $app . '" were not correctly replaced before running the update');
396
+					throw new \UnexpectedValueException('The files of the app "'.$app.'" were not correctly replaced before running the update');
397 397
 				}
398 398
 				\OC::$server->getAppManager()->disableApp($app);
399 399
 				$this->emit('\OC\Updater', 'incompatibleAppDisabled', array($app));
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 	 * @throws \Exception
432 432
 	 */
433 433
 	private function upgradeAppStoreApps(array $disabledApps) {
434
-		foreach($disabledApps as $app) {
434
+		foreach ($disabledApps as $app) {
435 435
 			try {
436 436
 				$this->emit('\OC\Updater', 'checkAppStoreAppBefore', [$app]);
437 437
 				if ($this->installer->isUpdateAvailable($app)) {
@@ -450,22 +450,22 @@  discard block
 block discarded – undo
450 450
 	 */
451 451
 	private function emitRepairEvents() {
452 452
 		$dispatcher = \OC::$server->getEventDispatcher();
453
-		$dispatcher->addListener('\OC\Repair::warning', function ($event) {
453
+		$dispatcher->addListener('\OC\Repair::warning', function($event) {
454 454
 			if ($event instanceof GenericEvent) {
455 455
 				$this->emit('\OC\Updater', 'repairWarning', $event->getArguments());
456 456
 			}
457 457
 		});
458
-		$dispatcher->addListener('\OC\Repair::error', function ($event) {
458
+		$dispatcher->addListener('\OC\Repair::error', function($event) {
459 459
 			if ($event instanceof GenericEvent) {
460 460
 				$this->emit('\OC\Updater', 'repairError', $event->getArguments());
461 461
 			}
462 462
 		});
463
-		$dispatcher->addListener('\OC\Repair::info', function ($event) {
463
+		$dispatcher->addListener('\OC\Repair::info', function($event) {
464 464
 			if ($event instanceof GenericEvent) {
465 465
 				$this->emit('\OC\Updater', 'repairInfo', $event->getArguments());
466 466
 			}
467 467
 		});
468
-		$dispatcher->addListener('\OC\Repair::step', function ($event) {
468
+		$dispatcher->addListener('\OC\Repair::step', function($event) {
469 469
 			if ($event instanceof GenericEvent) {
470 470
 				$this->emit('\OC\Updater', 'repairStep', $event->getArguments());
471 471
 			}
@@ -480,13 +480,13 @@  discard block
 block discarded – undo
480 480
 			if (!$event instanceof GenericEvent) {
481 481
 				return;
482 482
 			}
483
-			$log->info('\OC\DB\Migrator::executeSql: ' . $event->getSubject() . ' (' . $event->getArgument(0) . ' of ' . $event->getArgument(1) . ')', ['app' => 'updater']);
483
+			$log->info('\OC\DB\Migrator::executeSql: '.$event->getSubject().' ('.$event->getArgument(0).' of '.$event->getArgument(1).')', ['app' => 'updater']);
484 484
 		});
485 485
 		$dispatcher->addListener('\OC\DB\Migrator::checkTable', function($event) use ($log) {
486 486
 			if (!$event instanceof GenericEvent) {
487 487
 				return;
488 488
 			}
489
-			$log->info('\OC\DB\Migrator::checkTable: ' . $event->getSubject() . ' (' . $event->getArgument(0) . ' of ' . $event->getArgument(1) . ')', ['app' => 'updater']);
489
+			$log->info('\OC\DB\Migrator::checkTable: '.$event->getSubject().' ('.$event->getArgument(0).' of '.$event->getArgument(1).')', ['app' => 'updater']);
490 490
 		});
491 491
 
492 492
 		$repairListener = function($event) use ($log) {
@@ -495,30 +495,30 @@  discard block
 block discarded – undo
495 495
 			}
496 496
 			switch ($event->getSubject()) {
497 497
 				case '\OC\Repair::startProgress':
498
-					$log->info('\OC\Repair::startProgress: Starting ... ' . $event->getArgument(1) .  ' (' . $event->getArgument(0) . ')', ['app' => 'updater']);
498
+					$log->info('\OC\Repair::startProgress: Starting ... '.$event->getArgument(1).' ('.$event->getArgument(0).')', ['app' => 'updater']);
499 499
 					break;
500 500
 				case '\OC\Repair::advance':
501 501
 					$desc = $event->getArgument(1);
502 502
 					if (empty($desc)) {
503 503
 						$desc = '';
504 504
 					}
505
-					$log->info('\OC\Repair::advance: ' . $desc . ' (' . $event->getArgument(0) . ')', ['app' => 'updater']);
505
+					$log->info('\OC\Repair::advance: '.$desc.' ('.$event->getArgument(0).')', ['app' => 'updater']);
506 506
 
507 507
 					break;
508 508
 				case '\OC\Repair::finishProgress':
509 509
 					$log->info('\OC\Repair::finishProgress', ['app' => 'updater']);
510 510
 					break;
511 511
 				case '\OC\Repair::step':
512
-					$log->info('\OC\Repair::step: Repair step: ' . $event->getArgument(0), ['app' => 'updater']);
512
+					$log->info('\OC\Repair::step: Repair step: '.$event->getArgument(0), ['app' => 'updater']);
513 513
 					break;
514 514
 				case '\OC\Repair::info':
515
-					$log->info('\OC\Repair::info: Repair info: ' . $event->getArgument(0), ['app' => 'updater']);
515
+					$log->info('\OC\Repair::info: Repair info: '.$event->getArgument(0), ['app' => 'updater']);
516 516
 					break;
517 517
 				case '\OC\Repair::warning':
518
-					$log->warning('\OC\Repair::warning: Repair warning: ' . $event->getArgument(0), ['app' => 'updater']);
518
+					$log->warning('\OC\Repair::warning: Repair warning: '.$event->getArgument(0), ['app' => 'updater']);
519 519
 					break;
520 520
 				case '\OC\Repair::error':
521
-					$log->error('\OC\Repair::error: Repair error: ' . $event->getArgument(0), ['app' => 'updater']);
521
+					$log->error('\OC\Repair::error: Repair error: '.$event->getArgument(0), ['app' => 'updater']);
522 522
 					break;
523 523
 			}
524 524
 		};
@@ -532,74 +532,74 @@  discard block
 block discarded – undo
532 532
 		$dispatcher->addListener('\OC\Repair::error', $repairListener);
533 533
 
534 534
 
535
-		$this->listen('\OC\Updater', 'maintenanceEnabled', function () use($log) {
535
+		$this->listen('\OC\Updater', 'maintenanceEnabled', function() use($log) {
536 536
 			$log->info('\OC\Updater::maintenanceEnabled: Turned on maintenance mode', ['app' => 'updater']);
537 537
 		});
538
-		$this->listen('\OC\Updater', 'maintenanceDisabled', function () use($log) {
538
+		$this->listen('\OC\Updater', 'maintenanceDisabled', function() use($log) {
539 539
 			$log->info('\OC\Updater::maintenanceDisabled: Turned off maintenance mode', ['app' => 'updater']);
540 540
 		});
541
-		$this->listen('\OC\Updater', 'maintenanceActive', function () use($log) {
541
+		$this->listen('\OC\Updater', 'maintenanceActive', function() use($log) {
542 542
 			$log->info('\OC\Updater::maintenanceActive: Maintenance mode is kept active', ['app' => 'updater']);
543 543
 		});
544
-		$this->listen('\OC\Updater', 'updateEnd', function ($success) use($log) {
544
+		$this->listen('\OC\Updater', 'updateEnd', function($success) use($log) {
545 545
 			if ($success) {
546 546
 				$log->info('\OC\Updater::updateEnd: Update successful', ['app' => 'updater']);
547 547
 			} else {
548 548
 				$log->error('\OC\Updater::updateEnd: Update failed', ['app' => 'updater']);
549 549
 			}
550 550
 		});
551
-		$this->listen('\OC\Updater', 'dbUpgradeBefore', function () use($log) {
551
+		$this->listen('\OC\Updater', 'dbUpgradeBefore', function() use($log) {
552 552
 			$log->info('\OC\Updater::dbUpgradeBefore: Updating database schema', ['app' => 'updater']);
553 553
 		});
554
-		$this->listen('\OC\Updater', 'dbUpgrade', function () use($log) {
554
+		$this->listen('\OC\Updater', 'dbUpgrade', function() use($log) {
555 555
 			$log->info('\OC\Updater::dbUpgrade: Updated database', ['app' => 'updater']);
556 556
 		});
557
-		$this->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function () use($log) {
557
+		$this->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function() use($log) {
558 558
 			$log->info('\OC\Updater::dbSimulateUpgradeBefore: Checking whether the database schema can be updated (this can take a long time depending on the database size)', ['app' => 'updater']);
559 559
 		});
560
-		$this->listen('\OC\Updater', 'dbSimulateUpgrade', function () use($log) {
560
+		$this->listen('\OC\Updater', 'dbSimulateUpgrade', function() use($log) {
561 561
 			$log->info('\OC\Updater::dbSimulateUpgrade: Checked database schema update', ['app' => 'updater']);
562 562
 		});
563
-		$this->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use($log) {
564
-			$log->info('\OC\Updater::incompatibleAppDisabled: Disabled incompatible app: ' . $app, ['app' => 'updater']);
563
+		$this->listen('\OC\Updater', 'incompatibleAppDisabled', function($app) use($log) {
564
+			$log->info('\OC\Updater::incompatibleAppDisabled: Disabled incompatible app: '.$app, ['app' => 'updater']);
565 565
 		});
566
-		$this->listen('\OC\Updater', 'checkAppStoreAppBefore', function ($app) use($log) {
567
-			$log->info('\OC\Updater::checkAppStoreAppBefore: Checking for update of app "' . $app . '" in appstore', ['app' => 'updater']);
566
+		$this->listen('\OC\Updater', 'checkAppStoreAppBefore', function($app) use($log) {
567
+			$log->info('\OC\Updater::checkAppStoreAppBefore: Checking for update of app "'.$app.'" in appstore', ['app' => 'updater']);
568 568
 		});
569
-		$this->listen('\OC\Updater', 'upgradeAppStoreApp', function ($app) use($log) {
570
-			$log->info('\OC\Updater::upgradeAppStoreApp: Update app "' . $app . '" from appstore', ['app' => 'updater']);
569
+		$this->listen('\OC\Updater', 'upgradeAppStoreApp', function($app) use($log) {
570
+			$log->info('\OC\Updater::upgradeAppStoreApp: Update app "'.$app.'" from appstore', ['app' => 'updater']);
571 571
 		});
572
-		$this->listen('\OC\Updater', 'checkAppStoreApp', function ($app) use($log) {
573
-			$log->info('\OC\Updater::checkAppStoreApp: Checked for update of app "' . $app . '" in appstore', ['app' => 'updater']);
572
+		$this->listen('\OC\Updater', 'checkAppStoreApp', function($app) use($log) {
573
+			$log->info('\OC\Updater::checkAppStoreApp: Checked for update of app "'.$app.'" in appstore', ['app' => 'updater']);
574 574
 		});
575
-		$this->listen('\OC\Updater', 'appUpgradeCheckBefore', function () use ($log) {
575
+		$this->listen('\OC\Updater', 'appUpgradeCheckBefore', function() use ($log) {
576 576
 			$log->info('\OC\Updater::appUpgradeCheckBefore: Checking updates of apps', ['app' => 'updater']);
577 577
 		});
578
-		$this->listen('\OC\Updater', 'appSimulateUpdate', function ($app) use ($log) {
579
-			$log->info('\OC\Updater::appSimulateUpdate: Checking whether the database schema for <' . $app . '> can be updated (this can take a long time depending on the database size)', ['app' => 'updater']);
578
+		$this->listen('\OC\Updater', 'appSimulateUpdate', function($app) use ($log) {
579
+			$log->info('\OC\Updater::appSimulateUpdate: Checking whether the database schema for <'.$app.'> can be updated (this can take a long time depending on the database size)', ['app' => 'updater']);
580 580
 		});
581
-		$this->listen('\OC\Updater', 'appUpgradeCheck', function () use ($log) {
581
+		$this->listen('\OC\Updater', 'appUpgradeCheck', function() use ($log) {
582 582
 			$log->info('\OC\Updater::appUpgradeCheck: Checked database schema update for apps', ['app' => 'updater']);
583 583
 		});
584
-		$this->listen('\OC\Updater', 'appUpgradeStarted', function ($app) use ($log) {
585
-			$log->info('\OC\Updater::appUpgradeStarted: Updating <' . $app . '> ...', ['app' => 'updater']);
584
+		$this->listen('\OC\Updater', 'appUpgradeStarted', function($app) use ($log) {
585
+			$log->info('\OC\Updater::appUpgradeStarted: Updating <'.$app.'> ...', ['app' => 'updater']);
586 586
 		});
587
-		$this->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($log) {
588
-			$log->info('\OC\Updater::appUpgrade: Updated <' . $app . '> to ' . $version, ['app' => 'updater']);
587
+		$this->listen('\OC\Updater', 'appUpgrade', function($app, $version) use ($log) {
588
+			$log->info('\OC\Updater::appUpgrade: Updated <'.$app.'> to '.$version, ['app' => 'updater']);
589 589
 		});
590
-		$this->listen('\OC\Updater', 'failure', function ($message) use($log) {
591
-			$log->error('\OC\Updater::failure: ' . $message, ['app' => 'updater']);
590
+		$this->listen('\OC\Updater', 'failure', function($message) use($log) {
591
+			$log->error('\OC\Updater::failure: '.$message, ['app' => 'updater']);
592 592
 		});
593
-		$this->listen('\OC\Updater', 'setDebugLogLevel', function () use($log) {
593
+		$this->listen('\OC\Updater', 'setDebugLogLevel', function() use($log) {
594 594
 			$log->info('\OC\Updater::setDebugLogLevel: Set log level to debug', ['app' => 'updater']);
595 595
 		});
596
-		$this->listen('\OC\Updater', 'resetLogLevel', function ($logLevel, $logLevelName) use($log) {
597
-			$log->info('\OC\Updater::resetLogLevel: Reset log level to ' . $logLevelName . '(' . $logLevel . ')', ['app' => 'updater']);
596
+		$this->listen('\OC\Updater', 'resetLogLevel', function($logLevel, $logLevelName) use($log) {
597
+			$log->info('\OC\Updater::resetLogLevel: Reset log level to '.$logLevelName.'('.$logLevel.')', ['app' => 'updater']);
598 598
 		});
599
-		$this->listen('\OC\Updater', 'startCheckCodeIntegrity', function () use($log) {
599
+		$this->listen('\OC\Updater', 'startCheckCodeIntegrity', function() use($log) {
600 600
 			$log->info('\OC\Updater::startCheckCodeIntegrity: Starting code integrity check...', ['app' => 'updater']);
601 601
 		});
602
-		$this->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function () use($log) {
602
+		$this->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function() use($log) {
603 603
 			$log->info('\OC\Updater::finishedCheckCodeIntegrity: Finished code integrity check', ['app' => 'updater']);
604 604
 		});
605 605
 
Please login to merge, or discard this patch.
lib/private/legacy/app.php 1 patch
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
 		$apps = self::getEnabledApps();
111 111
 
112 112
 		// Add each apps' folder as allowed class path
113
-		foreach($apps as $app) {
113
+		foreach ($apps as $app) {
114 114
 			$path = self::getAppPath($app);
115
-			if($path !== false) {
115
+			if ($path !== false) {
116 116
 				self::registerAutoloading($app, $path);
117 117
 			}
118 118
 		}
@@ -137,17 +137,17 @@  discard block
 block discarded – undo
137 137
 	public static function loadApp($app) {
138 138
 		self::$loadedApps[] = $app;
139 139
 		$appPath = self::getAppPath($app);
140
-		if($appPath === false) {
140
+		if ($appPath === false) {
141 141
 			return;
142 142
 		}
143 143
 
144 144
 		// in case someone calls loadApp() directly
145 145
 		self::registerAutoloading($app, $appPath);
146 146
 
147
-		if (is_file($appPath . '/appinfo/app.php')) {
148
-			\OC::$server->getEventLogger()->start('load_app_' . $app, 'Load app: ' . $app);
147
+		if (is_file($appPath.'/appinfo/app.php')) {
148
+			\OC::$server->getEventLogger()->start('load_app_'.$app, 'Load app: '.$app);
149 149
 			self::requireAppFile($app);
150
-			\OC::$server->getEventLogger()->end('load_app_' . $app);
150
+			\OC::$server->getEventLogger()->end('load_app_'.$app);
151 151
 		}
152 152
 
153 153
 		$info = self::getAppInfo($app);
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 			$plugins = isset($info['collaboration']['plugins']['plugin']['@value']) ?
194 194
 				[$info['collaboration']['plugins']['plugin']] : $info['collaboration']['plugins']['plugin'];
195 195
 			foreach ($plugins as $plugin) {
196
-				if($plugin['@attributes']['type'] === 'collaborator-search') {
196
+				if ($plugin['@attributes']['type'] === 'collaborator-search') {
197 197
 					$pluginInfo = [
198 198
 						'shareType' => $plugin['@attributes']['share-type'],
199 199
 						'class' => $plugin['@value'],
@@ -212,8 +212,8 @@  discard block
 block discarded – undo
212 212
 	 * @param string $path
213 213
 	 */
214 214
 	public static function registerAutoloading($app, $path) {
215
-		$key = $app . '-' . $path;
216
-		if(isset(self::$alreadyRegistered[$key])) {
215
+		$key = $app.'-'.$path;
216
+		if (isset(self::$alreadyRegistered[$key])) {
217 217
 			return;
218 218
 		}
219 219
 
@@ -223,17 +223,17 @@  discard block
 block discarded – undo
223 223
 		$appNamespace = \OC\AppFramework\App::buildAppNamespace($app);
224 224
 		\OC::$server->registerNamespace($app, $appNamespace);
225 225
 
226
-		if (file_exists($path . '/composer/autoload.php')) {
227
-			require_once $path . '/composer/autoload.php';
226
+		if (file_exists($path.'/composer/autoload.php')) {
227
+			require_once $path.'/composer/autoload.php';
228 228
 		} else {
229
-			\OC::$composerAutoloader->addPsr4($appNamespace . '\\', $path . '/lib/', true);
229
+			\OC::$composerAutoloader->addPsr4($appNamespace.'\\', $path.'/lib/', true);
230 230
 			// Register on legacy autoloader
231 231
 			\OC::$loader->addValidRoot($path);
232 232
 		}
233 233
 
234 234
 		// Register Test namespace only when testing
235 235
 		if (defined('PHPUNIT_RUN') || defined('CLI_TEST_RUN')) {
236
-			\OC::$composerAutoloader->addPsr4($appNamespace . '\\Tests\\', $path . '/tests/', true);
236
+			\OC::$composerAutoloader->addPsr4($appNamespace.'\\Tests\\', $path.'/tests/', true);
237 237
 		}
238 238
 	}
239 239
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	private static function requireAppFile($app) {
246 246
 		try {
247 247
 			// encapsulated here to avoid variable scope conflicts
248
-			require_once $app . '/appinfo/app.php';
248
+			require_once $app.'/appinfo/app.php';
249 249
 		} catch (Error $ex) {
250 250
 			\OC::$server->getLogger()->logException($ex);
251 251
 			if (!\OC::$server->getAppManager()->isShipped($app)) {
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	 */
300 300
 	public static function setAppTypes($app) {
301 301
 		$appData = self::getAppInfo($app);
302
-		if(!is_array($appData)) {
302
+		if (!is_array($appData)) {
303 303
 			return;
304 304
 		}
305 305
 
@@ -346,8 +346,8 @@  discard block
 block discarded – undo
346 346
 		} else {
347 347
 			$apps = $appManager->getEnabledAppsForUser($user);
348 348
 		}
349
-		$apps = array_filter($apps, function ($app) {
350
-			return $app !== 'files';//we add this manually
349
+		$apps = array_filter($apps, function($app) {
350
+			return $app !== 'files'; //we add this manually
351 351
 		});
352 352
 		sort($apps);
353 353
 		array_unshift($apps, 'files');
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 		$installer = \OC::$server->query(Installer::class);
385 385
 		$isDownloaded = $installer->isDownloaded($appId);
386 386
 
387
-		if(!$isDownloaded) {
387
+		if (!$isDownloaded) {
388 388
 			$installer->downloadApp($appId);
389 389
 		}
390 390
 
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 	 */
461 461
 	public static function findAppInDirectories($appId) {
462 462
 		$sanitizedAppId = self::cleanAppId($appId);
463
-		if($sanitizedAppId !== $appId) {
463
+		if ($sanitizedAppId !== $appId) {
464 464
 			return false;
465 465
 		}
466 466
 		static $app_dir = array();
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
 
472 472
 		$possibleApps = array();
473 473
 		foreach (OC::$APPSROOTS as $dir) {
474
-			if (file_exists($dir['path'] . '/' . $appId)) {
474
+			if (file_exists($dir['path'].'/'.$appId)) {
475 475
 				$possibleApps[] = $dir;
476 476
 			}
477 477
 		}
@@ -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
 	}
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 	 */
527 527
 	public static function getAppWebPath($appId) {
528 528
 		if (($dir = self::findAppInDirectories($appId)) != false) {
529
-			return OC::$WEBROOT . $dir['url'] . '/' . $appId;
529
+			return OC::$WEBROOT.$dir['url'].'/'.$appId;
530 530
 		}
531 531
 		return false;
532 532
 	}
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
 	 * @return string
551 551
 	 */
552 552
 	public static function getAppVersionByPath($path) {
553
-		$infoFile = $path . '/appinfo/info.xml';
553
+		$infoFile = $path.'/appinfo/info.xml';
554 554
 		$appData = \OC::$server->getAppManager()->getAppInfo($infoFile, true);
555 555
 		return isset($appData['version']) ? $appData['version'] : '';
556 556
 	}
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 	 * @param string $page
651 651
 	 */
652 652
 	public static function registerAdmin($app, $page) {
653
-		self::$adminForms[] = $app . '/' . $page . '.php';
653
+		self::$adminForms[] = $app.'/'.$page.'.php';
654 654
 	}
655 655
 
656 656
 	/**
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 	 * @param string $page
660 660
 	 */
661 661
 	public static function registerPersonal($app, $page) {
662
-		self::$personalForms[] = $app . '/' . $page . '.php';
662
+		self::$personalForms[] = $app.'/'.$page.'.php';
663 663
 	}
664 664
 
665 665
 	/**
@@ -688,7 +688,7 @@  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'], \OCP\Util::WARN);
691
+				\OCP\Util::writeLog('core', 'unable to read app folder : '.$apps_dir['path'], \OCP\Util::WARN);
692 692
 				continue;
693 693
 			}
694 694
 			$dh = opendir($apps_dir['path']);
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 			if (is_resource($dh)) {
697 697
 				while (($file = readdir($dh)) !== false) {
698 698
 
699
-					if ($file[0] != '.' and is_dir($apps_dir['path'] . '/' . $file) and is_file($apps_dir['path'] . '/' . $file . '/appinfo/info.xml')) {
699
+					if ($file[0] != '.' and is_dir($apps_dir['path'].'/'.$file) and is_file($apps_dir['path'].'/'.$file.'/appinfo/info.xml')) {
700 700
 
701 701
 						$apps[] = $file;
702 702
 					}
@@ -729,12 +729,12 @@  discard block
 block discarded – undo
729 729
 
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 . '"', \OCP\Util::ERROR);
732
+					\OCP\Util::writeLog('core', 'Could not read app info file for app "'.$app.'"', \OCP\Util::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', \OCP\Util::ERROR);
737
+					\OCP\Util::writeLog('core', 'App id "'.$app.'" has no name in appinfo', \OCP\Util::ERROR);
738 738
 					continue;
739 739
 				}
740 740
 
@@ -761,13 +761,13 @@  discard block
 block discarded – undo
761 761
 				}
762 762
 
763 763
 				$appPath = self::getAppPath($app);
764
-				if($appPath !== false) {
765
-					$appIcon = $appPath . '/img/' . $app . '.svg';
764
+				if ($appPath !== false) {
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;
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
 	public static function getAppVersions() {
893 893
 		static $versions;
894 894
 
895
-		if(!$versions) {
895
+		if (!$versions) {
896 896
 			$appConfig = \OC::$server->getAppConfig();
897 897
 			$versions = $appConfig->getValues(false, 'installed_version');
898 898
 		}
@@ -907,7 +907,7 @@  discard block
 block discarded – undo
907 907
 	 */
908 908
 	public static function updateApp($appId) {
909 909
 		$appPath = self::getAppPath($appId);
910
-		if($appPath === false) {
910
+		if ($appPath === false) {
911 911
 			return false;
912 912
 		}
913 913
 		self::registerAutoloading($appId, $appPath);
@@ -915,8 +915,8 @@  discard block
 block discarded – undo
915 915
 		$appData = self::getAppInfo($appId);
916 916
 		self::executeRepairSteps($appId, $appData['repair-steps']['pre-migration']);
917 917
 
918
-		if (file_exists($appPath . '/appinfo/database.xml')) {
919
-			OC_DB::updateDbFromStructure($appPath . '/appinfo/database.xml');
918
+		if (file_exists($appPath.'/appinfo/database.xml')) {
919
+			OC_DB::updateDbFromStructure($appPath.'/appinfo/database.xml');
920 920
 		} else {
921 921
 			$ms = new MigrationService($appId, \OC::$server->getDatabaseConnection());
922 922
 			$ms->migrate();
@@ -928,23 +928,23 @@  discard block
 block discarded – undo
928 928
 		\OC::$server->getAppManager()->getAppVersion($appId, false);
929 929
 
930 930
 		// run upgrade code
931
-		if (file_exists($appPath . '/appinfo/update.php')) {
931
+		if (file_exists($appPath.'/appinfo/update.php')) {
932 932
 			self::loadApp($appId);
933
-			include $appPath . '/appinfo/update.php';
933
+			include $appPath.'/appinfo/update.php';
934 934
 		}
935 935
 		self::setupBackgroundJobs($appData['background-jobs']);
936 936
 
937 937
 		//set remote/public handlers
938 938
 		if (array_key_exists('ocsid', $appData)) {
939 939
 			\OC::$server->getConfig()->setAppValue($appId, 'ocsid', $appData['ocsid']);
940
-		} elseif(\OC::$server->getConfig()->getAppValue($appId, 'ocsid', null) !== null) {
940
+		} elseif (\OC::$server->getConfig()->getAppValue($appId, 'ocsid', null) !== null) {
941 941
 			\OC::$server->getConfig()->deleteAppValue($appId, 'ocsid');
942 942
 		}
943 943
 		foreach ($appData['remote'] as $name => $path) {
944
-			\OC::$server->getConfig()->setAppValue('core', 'remote_' . $name, $appId . '/' . $path);
944
+			\OC::$server->getConfig()->setAppValue('core', 'remote_'.$name, $appId.'/'.$path);
945 945
 		}
946 946
 		foreach ($appData['public'] as $name => $path) {
947
-			\OC::$server->getConfig()->setAppValue('core', 'public_' . $name, $appId . '/' . $path);
947
+			\OC::$server->getConfig()->setAppValue('core', 'public_'.$name, $appId.'/'.$path);
948 948
 		}
949 949
 
950 950
 		self::setAppTypes($appId);
@@ -1014,17 +1014,17 @@  discard block
 block discarded – undo
1014 1014
 	public static function getStorage($appId) {
1015 1015
 		if (\OC::$server->getAppManager()->isEnabledForUser($appId)) { //sanity check
1016 1016
 			if (\OC::$server->getUserSession()->isLoggedIn()) {
1017
-				$view = new \OC\Files\View('/' . OC_User::getUser());
1017
+				$view = new \OC\Files\View('/'.OC_User::getUser());
1018 1018
 				if (!$view->file_exists($appId)) {
1019 1019
 					$view->mkdir($appId);
1020 1020
 				}
1021
-				return new \OC\Files\View('/' . OC_User::getUser() . '/' . $appId);
1021
+				return new \OC\Files\View('/'.OC_User::getUser().'/'.$appId);
1022 1022
 			} else {
1023
-				\OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ', user not logged in', \OCP\Util::ERROR);
1023
+				\OCP\Util::writeLog('core', 'Can\'t get app storage, app '.$appId.', user not logged in', \OCP\Util::ERROR);
1024 1024
 				return false;
1025 1025
 			}
1026 1026
 		} else {
1027
-			\OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ' not enabled', \OCP\Util::ERROR);
1027
+			\OCP\Util::writeLog('core', 'Can\'t get app storage, app '.$appId.' not enabled', \OCP\Util::ERROR);
1028 1028
 			return false;
1029 1029
 		}
1030 1030
 	}
@@ -1056,9 +1056,9 @@  discard block
 block discarded – undo
1056 1056
 
1057 1057
 				if ($attributeLang === $similarLang) {
1058 1058
 					$similarLangFallback = $option['@value'];
1059
-				} else if (strpos($attributeLang, $similarLang . '_') === 0) {
1059
+				} else if (strpos($attributeLang, $similarLang.'_') === 0) {
1060 1060
 					if ($similarLangFallback === false) {
1061
-						$similarLangFallback =  $option['@value'];
1061
+						$similarLangFallback = $option['@value'];
1062 1062
 					}
1063 1063
 				}
1064 1064
 			} else {
@@ -1093,7 +1093,7 @@  discard block
 block discarded – undo
1093 1093
 			$data['description'] = trim(self::findBestL10NOption($data['description'], $lang));
1094 1094
 		} else if (isset($data['description']) && is_string($data['description'])) {
1095 1095
 			$data['description'] = trim($data['description']);
1096
-		} else  {
1096
+		} else {
1097 1097
 			$data['description'] = '';
1098 1098
 		}
1099 1099
 
Please login to merge, or discard this patch.