Passed
Push — master ( bb40e6...385330 )
by Julius
14:49 queued 11s
created
lib/public/HintException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
 	 * @return string
63 63
 	 */
64 64
 	public function __toString(): string {
65
-		return __CLASS__ . ": [{$this->code}]: {$this->message} ({$this->hint})\n";
65
+		return __CLASS__.": [{$this->code}]: {$this->message} ({$this->hint})\n";
66 66
 	}
67 67
 
68 68
 	/**
Please login to merge, or discard this patch.
lib/private/legacy/OC_Util.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
 	private static function initLocalStorageRootFS() {
94 94
 		// mount local file backend as root
95
-		$configDataDirectory = \OC::$server->getSystemConfig()->getValue("datadirectory", OC::$SERVERROOT . "/data");
95
+		$configDataDirectory = \OC::$server->getSystemConfig()->getValue("datadirectory", OC::$SERVERROOT."/data");
96 96
 		//first set up the local "root" storage
97 97
 		\OC\Files\Filesystem::initMountManager();
98 98
 		if (!self::$rootMounted) {
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 		\OC\Files\Filesystem::initMountManager();
215 215
 
216 216
 		$prevLogging = \OC\Files\Filesystem::logWarningWhenAddingStorageWrapper(false);
217
-		\OC\Files\Filesystem::addStorageWrapper('mount_options', function ($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) {
217
+		\OC\Files\Filesystem::addStorageWrapper('mount_options', function($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) {
218 218
 			if ($storage->instanceOfStorage('\OC\Files\Storage\Common')) {
219 219
 				/** @var \OC\Files\Storage\Common $storage */
220 220
 				$storage->setMountOptions($mount->getOptions());
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 			return $storage;
223 223
 		});
224 224
 
225
-		\OC\Files\Filesystem::addStorageWrapper('enable_sharing', function ($mountPoint, \OCP\Files\Storage\IStorage $storage, \OCP\Files\Mount\IMountPoint $mount) {
225
+		\OC\Files\Filesystem::addStorageWrapper('enable_sharing', function($mountPoint, \OCP\Files\Storage\IStorage $storage, \OCP\Files\Mount\IMountPoint $mount) {
226 226
 			if (!$mount->getOption('enable_sharing', true)) {
227 227
 				return new \OC\Files\Storage\Wrapper\PermissionsMask([
228 228
 					'storage' => $storage,
@@ -233,21 +233,21 @@  discard block
 block discarded – undo
233 233
 		});
234 234
 
235 235
 		// install storage availability wrapper, before most other wrappers
236
-		\OC\Files\Filesystem::addStorageWrapper('oc_availability', function ($mountPoint, \OCP\Files\Storage\IStorage $storage) {
236
+		\OC\Files\Filesystem::addStorageWrapper('oc_availability', function($mountPoint, \OCP\Files\Storage\IStorage $storage) {
237 237
 			if (!$storage->instanceOfStorage('\OCA\Files_Sharing\SharedStorage') && !$storage->isLocal()) {
238 238
 				return new \OC\Files\Storage\Wrapper\Availability(['storage' => $storage]);
239 239
 			}
240 240
 			return $storage;
241 241
 		});
242 242
 
243
-		\OC\Files\Filesystem::addStorageWrapper('oc_encoding', function ($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) {
243
+		\OC\Files\Filesystem::addStorageWrapper('oc_encoding', function($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) {
244 244
 			if ($mount->getOption('encoding_compatibility', false) && !$storage->instanceOfStorage('\OCA\Files_Sharing\SharedStorage') && !$storage->isLocal()) {
245 245
 				return new \OC\Files\Storage\Wrapper\Encoding(['storage' => $storage]);
246 246
 			}
247 247
 			return $storage;
248 248
 		});
249 249
 
250
-		\OC\Files\Filesystem::addStorageWrapper('oc_quota', function ($mountPoint, $storage) {
250
+		\OC\Files\Filesystem::addStorageWrapper('oc_quota', function($mountPoint, $storage) {
251 251
 			// set up quota for home storages, even for other users
252 252
 			// which can happen when using sharing
253 253
 
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 			return $storage;
270 270
 		});
271 271
 
272
-		\OC\Files\Filesystem::addStorageWrapper('readonly', function ($mountPoint, \OCP\Files\Storage\IStorage $storage, \OCP\Files\Mount\IMountPoint $mount) {
272
+		\OC\Files\Filesystem::addStorageWrapper('readonly', function($mountPoint, \OCP\Files\Storage\IStorage $storage, \OCP\Files\Mount\IMountPoint $mount) {
273 273
 			/*
274 274
 			 * Do not allow any operations that modify the storage
275 275
 			 */
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 
321 321
 		//if we aren't logged in, there is no use to set up the filesystem
322 322
 		if ($user != "") {
323
-			$userDir = '/' . $user . '/files';
323
+			$userDir = '/'.$user.'/files';
324 324
 
325 325
 			//jail the user into his "home" directory
326 326
 			\OC\Files\Filesystem::init($user, $userDir);
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 		/** @var LoggerInterface $logger */
400 400
 		$logger = \OC::$server->get(LoggerInterface::class);
401 401
 
402
-		$plainSkeletonDirectory = \OC::$server->getConfig()->getSystemValue('skeletondirectory', \OC::$SERVERROOT . '/core/skeleton');
402
+		$plainSkeletonDirectory = \OC::$server->getConfig()->getSystemValue('skeletondirectory', \OC::$SERVERROOT.'/core/skeleton');
403 403
 		$userLang = \OC::$server->getL10NFactory()->findLanguage();
404 404
 		$skeletonDirectory = str_replace('{lang}', $userLang, $plainSkeletonDirectory);
405 405
 
@@ -421,9 +421,9 @@  discard block
 block discarded – undo
421 421
 		if ($instanceId === null) {
422 422
 			throw new \RuntimeException('no instance id!');
423 423
 		}
424
-		$appdata = 'appdata_' . $instanceId;
424
+		$appdata = 'appdata_'.$instanceId;
425 425
 		if ($userId === $appdata) {
426
-			throw new \RuntimeException('username is reserved name: ' . $appdata);
426
+			throw new \RuntimeException('username is reserved name: '.$appdata);
427 427
 		}
428 428
 
429 429
 		if (!empty($skeletonDirectory)) {
@@ -458,14 +458,14 @@  discard block
 block discarded – undo
458 458
 		// Copy the files
459 459
 		while (false !== ($file = readdir($dir))) {
460 460
 			if (!\OC\Files\Filesystem::isIgnoredDir($file)) {
461
-				if (is_dir($source . '/' . $file)) {
461
+				if (is_dir($source.'/'.$file)) {
462 462
 					$child = $target->newFolder($file);
463
-					self::copyr($source . '/' . $file, $child);
463
+					self::copyr($source.'/'.$file, $child);
464 464
 				} else {
465 465
 					$child = $target->newFile($file);
466
-					$sourceStream = fopen($source . '/' . $file, 'r');
466
+					$sourceStream = fopen($source.'/'.$file, 'r');
467 467
 					if ($sourceStream === false) {
468
-						$logger->error(sprintf('Could not fopen "%s"', $source . '/' . $file), ['app' => 'core']);
468
+						$logger->error(sprintf('Could not fopen "%s"', $source.'/'.$file), ['app' => 'core']);
469 469
 						closedir($dir);
470 470
 						return;
471 471
 					}
@@ -542,8 +542,8 @@  discard block
 block discarded – undo
542 542
 			return;
543 543
 		}
544 544
 
545
-		$timestamp = filemtime(OC::$SERVERROOT . '/version.php');
546
-		require OC::$SERVERROOT . '/version.php';
545
+		$timestamp = filemtime(OC::$SERVERROOT.'/version.php');
546
+		require OC::$SERVERROOT.'/version.php';
547 547
 		/** @var int $timestamp */
548 548
 		self::$versionCache['OC_Version_Timestamp'] = $timestamp;
549 549
 		/** @var string $OC_Version */
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
 	public static function checkServer(\OC\SystemConfig $config) {
714 714
 		$l = \OC::$server->getL10N('lib');
715 715
 		$errors = [];
716
-		$CONFIG_DATADIRECTORY = $config->getValue('datadirectory', OC::$SERVERROOT . '/data');
716
+		$CONFIG_DATADIRECTORY = $config->getValue('datadirectory', OC::$SERVERROOT.'/data');
717 717
 
718 718
 		if (!self::needUpgrade($config) && $config->getValue('installed', false)) {
719 719
 			// this check needs to be done every time
@@ -753,9 +753,9 @@  discard block
 block discarded – undo
753 753
 				$errors[] = [
754 754
 					'error' => $l->t('Cannot write into "config" directory'),
755 755
 					'hint' => $l->t('This can usually be fixed by giving the webserver write access to the config directory. See %s',
756
-						[ $urlGenerator->linkToDocs('admin-dir_permissions') ]) . '. '
756
+						[$urlGenerator->linkToDocs('admin-dir_permissions')]).'. '
757 757
 						. $l->t('Or, if you prefer to keep config.php file read only, set the option "config_is_read_only" to true in it. See %s',
758
-						[ $urlGenerator->linkToDocs('admin-config') ])
758
+						[$urlGenerator->linkToDocs('admin-config')])
759 759
 				];
760 760
 			}
761 761
 		}
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
 			$version -= ($minor * 100);
931 931
 			$patch = $version;
932 932
 			$errors[] = [
933
-				'error' => $l->t('libxml2 2.7.0 is at least required. Currently %s is installed.', [$major . '.' . $minor . '.' . $patch]),
933
+				'error' => $l->t('libxml2 2.7.0 is at least required. Currently %s is installed.', [$major.'.'.$minor.'.'.$patch]),
934 934
 				'hint' => $l->t('To fix this issue update your libxml2 version and restart your web server.')
935 935
 			];
936 936
 		}
@@ -1033,10 +1033,10 @@  discard block
 block discarded – undo
1033 1033
 				'hint' => $l->t('Check the value of "datadirectory" in your configuration')
1034 1034
 			];
1035 1035
 		}
1036
-		if (!file_exists($dataDirectory . '/.ocdata')) {
1036
+		if (!file_exists($dataDirectory.'/.ocdata')) {
1037 1037
 			$errors[] = [
1038 1038
 				'error' => $l->t('Your data directory is invalid'),
1039
-				'hint' => $l->t('Ensure there is a file called ".ocdata"' .
1039
+				'hint' => $l->t('Ensure there is a file called ".ocdata"'.
1040 1040
 					' in the root of the data directory.')
1041 1041
 			];
1042 1042
 		}
@@ -1052,7 +1052,7 @@  discard block
 block discarded – undo
1052 1052
 	public static function checkLoggedIn() {
1053 1053
 		// Check if we are a user
1054 1054
 		if (!\OC::$server->getUserSession()->isLoggedIn()) {
1055
-			header('Location: ' . \OC::$server->getURLGenerator()->linkToRoute(
1055
+			header('Location: '.\OC::$server->getURLGenerator()->linkToRoute(
1056 1056
 						'core.login.showLoginForm',
1057 1057
 						[
1058 1058
 							'redirect_url' => \OC::$server->getRequest()->getRequestUri(),
@@ -1063,7 +1063,7 @@  discard block
 block discarded – undo
1063 1063
 		}
1064 1064
 		// Redirect to 2FA challenge selection if 2FA challenge was not solved yet
1065 1065
 		if (\OC::$server->getTwoFactorAuthManager()->needsSecondFactor(\OC::$server->getUserSession()->getUser())) {
1066
-			header('Location: ' . \OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.selectChallenge'));
1066
+			header('Location: '.\OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.selectChallenge'));
1067 1067
 			exit();
1068 1068
 		}
1069 1069
 	}
@@ -1076,7 +1076,7 @@  discard block
 block discarded – undo
1076 1076
 	public static function checkAdminUser() {
1077 1077
 		OC_Util::checkLoggedIn();
1078 1078
 		if (!OC_User::isAdminUser(OC_User::getUser())) {
1079
-			header('Location: ' . \OCP\Util::linkToAbsolute('', 'index.php'));
1079
+			header('Location: '.\OCP\Util::linkToAbsolute('', 'index.php'));
1080 1080
 			exit();
1081 1081
 		}
1082 1082
 	}
@@ -1123,9 +1123,9 @@  discard block
 block discarded – undo
1123 1123
 				}
1124 1124
 
1125 1125
 				if ($config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true') {
1126
-					$location = $urlGenerator->getAbsoluteURL('/apps/' . $appId . '/');
1126
+					$location = $urlGenerator->getAbsoluteURL('/apps/'.$appId.'/');
1127 1127
 				} else {
1128
-					$location = $urlGenerator->getAbsoluteURL('/index.php/apps/' . $appId . '/');
1128
+					$location = $urlGenerator->getAbsoluteURL('/index.php/apps/'.$appId.'/');
1129 1129
 				}
1130 1130
 			}
1131 1131
 		}
@@ -1139,7 +1139,7 @@  discard block
 block discarded – undo
1139 1139
 	 */
1140 1140
 	public static function redirectToDefaultPage() {
1141 1141
 		$location = self::getDefaultPageUrl();
1142
-		header('Location: ' . $location);
1142
+		header('Location: '.$location);
1143 1143
 		exit();
1144 1144
 	}
1145 1145
 
@@ -1152,7 +1152,7 @@  discard block
 block discarded – undo
1152 1152
 		$id = \OC::$server->getSystemConfig()->getValue('instanceid', null);
1153 1153
 		if (is_null($id)) {
1154 1154
 			// We need to guarantee at least one letter in instanceid so it can be used as the session_name
1155
-			$id = 'oc' . \OC::$server->getSecureRandom()->generate(10, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_DIGITS);
1155
+			$id = 'oc'.\OC::$server->getSecureRandom()->generate(10, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_DIGITS);
1156 1156
 			\OC::$server->getSystemConfig()->setValue('instanceid', $id);
1157 1157
 		}
1158 1158
 		return $id;
@@ -1169,12 +1169,12 @@  discard block
 block discarded – undo
1169 1169
 	 */
1170 1170
 	public static function sanitizeHTML($value) {
1171 1171
 		if (is_array($value)) {
1172
-			$value = array_map(function ($value) {
1172
+			$value = array_map(function($value) {
1173 1173
 				return self::sanitizeHTML($value);
1174 1174
 			}, $value);
1175 1175
 		} else {
1176 1176
 			// Specify encoding for PHP<5.4
1177
-			$value = htmlspecialchars((string)$value, ENT_QUOTES, 'UTF-8');
1177
+			$value = htmlspecialchars((string) $value, ENT_QUOTES, 'UTF-8');
1178 1178
 		}
1179 1179
 		return $value;
1180 1180
 	}
@@ -1207,7 +1207,7 @@  discard block
 block discarded – undo
1207 1207
 		$testContent = 'This is used for testing whether htaccess is properly enabled to disallow access from the outside. This file can be safely removed.';
1208 1208
 
1209 1209
 		// creating a test file
1210
-		$testFile = $config->getSystemValue('datadirectory', OC::$SERVERROOT . '/data') . '/' . $fileName;
1210
+		$testFile = $config->getSystemValue('datadirectory', OC::$SERVERROOT.'/data').'/'.$fileName;
1211 1211
 
1212 1212
 		if (file_exists($testFile)) {// already running this test, possible recursive call
1213 1213
 			return false;
@@ -1216,7 +1216,7 @@  discard block
 block discarded – undo
1216 1216
 		$fp = @fopen($testFile, 'w');
1217 1217
 		if (!$fp) {
1218 1218
 			throw new \OCP\HintException('Can\'t create test file to check for working .htaccess file.',
1219
-				'Make sure it is possible for the webserver to write to ' . $testFile);
1219
+				'Make sure it is possible for the webserver to write to '.$testFile);
1220 1220
 		}
1221 1221
 		fwrite($fp, $testContent);
1222 1222
 		fclose($fp);
@@ -1243,10 +1243,10 @@  discard block
 block discarded – undo
1243 1243
 		}
1244 1244
 
1245 1245
 		$fileName = '/htaccesstest.txt';
1246
-		$testFile = $config->getSystemValue('datadirectory', OC::$SERVERROOT . '/data') . '/' . $fileName;
1246
+		$testFile = $config->getSystemValue('datadirectory', OC::$SERVERROOT.'/data').'/'.$fileName;
1247 1247
 
1248 1248
 		// accessing the file via http
1249
-		$url = \OC::$server->getURLGenerator()->getAbsoluteURL(OC::$WEBROOT . '/data' . $fileName);
1249
+		$url = \OC::$server->getURLGenerator()->getAbsoluteURL(OC::$WEBROOT.'/data'.$fileName);
1250 1250
 		try {
1251 1251
 			$content = \OC::$server->getHTTPClientService()->newClient()->get($url)->getBody();
1252 1252
 		} catch (\Exception $e) {
@@ -1254,9 +1254,9 @@  discard block
 block discarded – undo
1254 1254
 		}
1255 1255
 
1256 1256
 		if (strpos($url, 'https:') === 0) {
1257
-			$url = 'http:' . substr($url, 6);
1257
+			$url = 'http:'.substr($url, 6);
1258 1258
 		} else {
1259
-			$url = 'https:' . substr($url, 5);
1259
+			$url = 'https:'.substr($url, 5);
1260 1260
 		}
1261 1261
 
1262 1262
 		try {
@@ -1346,7 +1346,7 @@  discard block
 block discarded – undo
1346 1346
 		$theme = \OC::$server->getSystemConfig()->getValue("theme", '');
1347 1347
 
1348 1348
 		if ($theme === '') {
1349
-			if (is_dir(OC::$SERVERROOT . '/themes/default')) {
1349
+			if (is_dir(OC::$SERVERROOT.'/themes/default')) {
1350 1350
 				$theme = 'default';
1351 1351
 			}
1352 1352
 		}
@@ -1367,7 +1367,7 @@  discard block
 block discarded – undo
1367 1367
 
1368 1368
 		$normalizedValue = Normalizer::normalize($value);
1369 1369
 		if ($normalizedValue === null || $normalizedValue === false) {
1370
-			\OC::$server->getLogger()->warning('normalizing failed for "' . $value . '"', ['app' => 'core']);
1370
+			\OC::$server->getLogger()->warning('normalizing failed for "'.$value.'"', ['app' => 'core']);
1371 1371
 			return $value;
1372 1372
 		}
1373 1373
 
@@ -1383,7 +1383,7 @@  discard block
 block discarded – undo
1383 1383
 		$version = OC_Util::getVersionString();
1384 1384
 		$build = OC_Util::getBuild();
1385 1385
 		if (!empty($build) and OC_Util::getChannel() === 'daily') {
1386
-			$version .= ' Build:' . $build;
1386
+			$version .= ' Build:'.$build;
1387 1387
 		}
1388 1388
 		return $version;
1389 1389
 	}
@@ -1405,7 +1405,7 @@  discard block
 block discarded – undo
1405 1405
 		}
1406 1406
 
1407 1407
 		// detect part files
1408
-		if (preg_match('/' . \OCP\Files\FileInfo::BLACKLIST_FILES_REGEX . '/', $trimmed) !== 0) {
1408
+		if (preg_match('/'.\OCP\Files\FileInfo::BLACKLIST_FILES_REGEX.'/', $trimmed) !== 0) {
1409 1409
 			return false;
1410 1410
 		}
1411 1411
 
@@ -1436,19 +1436,19 @@  discard block
 block discarded – undo
1436 1436
 			} elseif ($config->getValue('debug', false) && $versionDiff < 0) {
1437 1437
 				// downgrade with debug
1438 1438
 				$installedMajor = explode('.', $installedVersion);
1439
-				$installedMajor = $installedMajor[0] . '.' . $installedMajor[1];
1439
+				$installedMajor = $installedMajor[0].'.'.$installedMajor[1];
1440 1440
 				$currentMajor = explode('.', $currentVersion);
1441
-				$currentMajor = $currentMajor[0] . '.' . $currentMajor[1];
1441
+				$currentMajor = $currentMajor[0].'.'.$currentMajor[1];
1442 1442
 				if ($installedMajor === $currentMajor) {
1443 1443
 					// Same major, allow downgrade for developers
1444 1444
 					return true;
1445 1445
 				} else {
1446 1446
 					// downgrade attempt, throw exception
1447
-					throw new \OCP\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from ' . $installedVersion . ' to ' . $currentVersion . ')');
1447
+					throw new \OCP\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from '.$installedVersion.' to '.$currentVersion.')');
1448 1448
 				}
1449 1449
 			} elseif ($versionDiff < 0) {
1450 1450
 				// downgrade attempt, throw exception
1451
-				throw new \OCP\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from ' . $installedVersion . ' to ' . $currentVersion . ')');
1451
+				throw new \OCP\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from '.$installedVersion.' to '.$currentVersion.')');
1452 1452
 			}
1453 1453
 
1454 1454
 			// also check for upgrades for apps (independently from the user)
Please login to merge, or discard this patch.
lib/base.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -139,13 +139,13 @@  discard block
 block discarded – undo
139 139
 	 */
140 140
 	public static function initPaths() {
141 141
 		if (defined('PHPUNIT_CONFIG_DIR')) {
142
-			self::$configDir = OC::$SERVERROOT . '/' . PHPUNIT_CONFIG_DIR . '/';
143
-		} elseif (defined('PHPUNIT_RUN') and PHPUNIT_RUN and is_dir(OC::$SERVERROOT . '/tests/config/')) {
144
-			self::$configDir = OC::$SERVERROOT . '/tests/config/';
142
+			self::$configDir = OC::$SERVERROOT.'/'.PHPUNIT_CONFIG_DIR.'/';
143
+		} elseif (defined('PHPUNIT_RUN') and PHPUNIT_RUN and is_dir(OC::$SERVERROOT.'/tests/config/')) {
144
+			self::$configDir = OC::$SERVERROOT.'/tests/config/';
145 145
 		} elseif ($dir = getenv('NEXTCLOUD_CONFIG_DIR')) {
146
-			self::$configDir = rtrim($dir, '/') . '/';
146
+			self::$configDir = rtrim($dir, '/').'/';
147 147
 		} else {
148
-			self::$configDir = OC::$SERVERROOT . '/config/';
148
+			self::$configDir = OC::$SERVERROOT.'/config/';
149 149
 		}
150 150
 		self::$config = new \OC\Config(self::$configDir);
151 151
 
@@ -167,9 +167,9 @@  discard block
 block discarded – undo
167 167
 			//make sure suburi follows the same rules as scriptName
168 168
 			if (substr(OC::$SUBURI, -9) != 'index.php') {
169 169
 				if (substr(OC::$SUBURI, -1) != '/') {
170
-					OC::$SUBURI = OC::$SUBURI . '/';
170
+					OC::$SUBURI = OC::$SUBURI.'/';
171 171
 				}
172
-				OC::$SUBURI = OC::$SUBURI . 'index.php';
172
+				OC::$SUBURI = OC::$SUBURI.'index.php';
173 173
 			}
174 174
 		}
175 175
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 				OC::$WEBROOT = substr($scriptName, 0, 0 - strlen(OC::$SUBURI));
182 182
 
183 183
 				if (OC::$WEBROOT != '' && OC::$WEBROOT[0] !== '/') {
184
-					OC::$WEBROOT = '/' . OC::$WEBROOT;
184
+					OC::$WEBROOT = '/'.OC::$WEBROOT;
185 185
 				}
186 186
 			} else {
187 187
 				// The scriptName is not ending with OC::$SUBURI
@@ -210,8 +210,8 @@  discard block
 block discarded – undo
210 210
 					OC::$APPSROOTS[] = $paths;
211 211
 				}
212 212
 			}
213
-		} elseif (file_exists(OC::$SERVERROOT . '/apps')) {
214
-			OC::$APPSROOTS[] = ['path' => OC::$SERVERROOT . '/apps', 'url' => '/apps', 'writable' => true];
213
+		} elseif (file_exists(OC::$SERVERROOT.'/apps')) {
214
+			OC::$APPSROOTS[] = ['path' => OC::$SERVERROOT.'/apps', 'url' => '/apps', 'writable' => true];
215 215
 		}
216 216
 
217 217
 		if (empty(OC::$APPSROOTS)) {
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 		$l = \OC::$server->getL10N('lib');
238 238
 
239 239
 		// Create config if it does not already exist
240
-		$configFilePath = self::$configDir .'/config.php';
240
+		$configFilePath = self::$configDir.'/config.php';
241 241
 		if (!file_exists($configFilePath)) {
242 242
 			@touch($configFilePath);
243 243
 		}
@@ -253,14 +253,14 @@  discard block
 block discarded – undo
253 253
 				echo $l->t('This can usually be fixed by giving the webserver write access to the config directory.')."\n";
254 254
 				echo "\n";
255 255
 				echo $l->t('But, if you prefer to keep config.php file read only, set the option "config_is_read_only" to true in it.')."\n";
256
-				echo $l->t('See %s', [ $urlGenerator->linkToDocs('admin-config') ])."\n";
256
+				echo $l->t('See %s', [$urlGenerator->linkToDocs('admin-config')])."\n";
257 257
 				exit;
258 258
 			} else {
259 259
 				OC_Template::printErrorPage(
260 260
 					$l->t('Cannot write into "config" directory!'),
261
-					$l->t('This can usually be fixed by giving the webserver write access to the config directory.') . ' '
262
-					. $l->t('But, if you prefer to keep config.php file read only, set the option "config_is_read_only" to true in it.') . ' '
263
-					. $l->t('See %s', [ $urlGenerator->linkToDocs('admin-config') ]),
261
+					$l->t('This can usually be fixed by giving the webserver write access to the config directory.').' '
262
+					. $l->t('But, if you prefer to keep config.php file read only, set the option "config_is_read_only" to true in it.').' '
263
+					. $l->t('See %s', [$urlGenerator->linkToDocs('admin-config')]),
264 264
 					503
265 265
 				);
266 266
 			}
@@ -276,8 +276,8 @@  discard block
 block discarded – undo
276 276
 			if (OC::$CLI) {
277 277
 				throw new Exception('Not installed');
278 278
 			} else {
279
-				$url = OC::$WEBROOT . '/index.php';
280
-				header('Location: ' . $url);
279
+				$url = OC::$WEBROOT.'/index.php';
280
+				header('Location: '.$url);
281 281
 			}
282 282
 			exit();
283 283
 		}
@@ -381,14 +381,14 @@  discard block
 block discarded – undo
381 381
 		$incompatibleShippedApps = [];
382 382
 		foreach ($incompatibleApps as $appInfo) {
383 383
 			if ($appManager->isShipped($appInfo['id'])) {
384
-				$incompatibleShippedApps[] = $appInfo['name'] . ' (' . $appInfo['id'] . ')';
384
+				$incompatibleShippedApps[] = $appInfo['name'].' ('.$appInfo['id'].')';
385 385
 			}
386 386
 		}
387 387
 
388 388
 		if (!empty($incompatibleShippedApps)) {
389 389
 			$l = \OC::$server->getL10N('core');
390 390
 			$hint = $l->t('The files of the app %1$s were not replaced correctly. Make sure it is a version compatible with the server.', [implode(', ', $incompatibleShippedApps)]);
391
-			throw new \OCP\HintException('The files of the app ' . implode(', ', $incompatibleShippedApps) . ' were not replaced correctly. Make sure it is a version compatible with the server.', $hint);
391
+			throw new \OCP\HintException('The files of the app '.implode(', ', $incompatibleShippedApps).' were not replaced correctly. Make sure it is a version compatible with the server.', $hint);
392 392
 		}
393 393
 
394 394
 		$tmpl->assign('appsToUpgrade', $appManager->getAppsNeedingUpgrade($ocVersion));
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 		ini_set('session.cookie_httponly', 'true');
413 413
 
414 414
 		// set the cookie path to the Nextcloud directory
415
-		$cookie_path = OC::$WEBROOT ? : '/';
415
+		$cookie_path = OC::$WEBROOT ?: '/';
416 416
 		ini_set('session.cookie_path', $cookie_path);
417 417
 
418 418
 		// Let the session name be changed in the initSession Hook
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 		// session timeout
440 440
 		if ($session->exists('LAST_ACTIVITY') && (time() - $session->get('LAST_ACTIVITY') > $sessionLifeTime)) {
441 441
 			if (isset($_COOKIE[session_name()])) {
442
-				setcookie(session_name(), '', -1, self::$WEBROOT ? : '/');
442
+				setcookie(session_name(), '', -1, self::$WEBROOT ?: '/');
443 443
 			}
444 444
 			\OC::$server->getUserSession()->logout();
445 445
 		}
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 		foreach ($policies as $policy) {
483 483
 			header(
484 484
 				sprintf(
485
-					'Set-Cookie: %snc_sameSiteCookie%s=true; path=%s; httponly;' . $secureCookie . 'expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=%s',
485
+					'Set-Cookie: %snc_sameSiteCookie%s=true; path=%s; httponly;'.$secureCookie.'expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=%s',
486 486
 					$cookiePrefix,
487 487
 					$policy,
488 488
 					$cookieParams['path'],
@@ -556,12 +556,12 @@  discard block
 block discarded – undo
556 556
 
557 557
 		// register autoloader
558 558
 		$loaderStart = microtime(true);
559
-		require_once __DIR__ . '/autoloader.php';
559
+		require_once __DIR__.'/autoloader.php';
560 560
 		self::$loader = new \OC\Autoloader([
561
-			OC::$SERVERROOT . '/lib/private/legacy',
561
+			OC::$SERVERROOT.'/lib/private/legacy',
562 562
 		]);
563 563
 		if (defined('PHPUNIT_RUN')) {
564
-			self::$loader->addValidRoot(OC::$SERVERROOT . '/tests');
564
+			self::$loader->addValidRoot(OC::$SERVERROOT.'/tests');
565 565
 		}
566 566
 		spl_autoload_register([self::$loader, 'load']);
567 567
 		$loaderEnd = microtime(true);
@@ -569,12 +569,12 @@  discard block
 block discarded – undo
569 569
 		self::$CLI = (php_sapi_name() == 'cli');
570 570
 
571 571
 		// Add default composer PSR-4 autoloader
572
-		self::$composerAutoloader = require_once OC::$SERVERROOT . '/lib/composer/autoload.php';
572
+		self::$composerAutoloader = require_once OC::$SERVERROOT.'/lib/composer/autoload.php';
573 573
 
574 574
 		try {
575 575
 			self::initPaths();
576 576
 			// setup 3rdparty autoloader
577
-			$vendorAutoLoad = OC::$SERVERROOT. '/3rdparty/autoload.php';
577
+			$vendorAutoLoad = OC::$SERVERROOT.'/3rdparty/autoload.php';
578 578
 			if (!file_exists($vendorAutoLoad)) {
579 579
 				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".');
580 580
 			}
@@ -670,11 +670,11 @@  discard block
 block discarded – undo
670 670
 				// Convert l10n string into regular string for usage in database
671 671
 				$staticErrors = [];
672 672
 				foreach ($errors as $error) {
673
-					echo $error['error'] . "\n";
674
-					echo $error['hint'] . "\n\n";
673
+					echo $error['error']."\n";
674
+					echo $error['hint']."\n\n";
675 675
 					$staticErrors[] = [
676
-						'error' => (string)$error['error'],
677
-						'hint' => (string)$error['hint'],
676
+						'error' => (string) $error['error'],
677
+						'hint' => (string) $error['hint'],
678 678
 					];
679 679
 				}
680 680
 
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
 		}
691 691
 		//try to set the session lifetime
692 692
 		$sessionLifeTime = self::getSessionLifeTime();
693
-		@ini_set('gc_maxlifetime', (string)$sessionLifeTime);
693
+		@ini_set('gc_maxlifetime', (string) $sessionLifeTime);
694 694
 
695 695
 		// User and Groups
696 696
 		if (!$systemConfig->getValue("installed", false)) {
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
 
801 801
 			// NOTE: This will be replaced to use OCP
802 802
 			$userSession = self::$server->getUserSession();
803
-			$userSession->listen('\OC\User', 'postLogin', function () use ($userSession) {
803
+			$userSession->listen('\OC\User', 'postLogin', function() use ($userSession) {
804 804
 				if (!defined('PHPUNIT_RUN') && $userSession->isLoggedIn()) {
805 805
 					// reset brute force delay for this IP address and username
806 806
 					$uid = \OC::$server->getUserSession()->getUser()->getUID();
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
 	private static function registerAppRestrictionsHooks() {
853 853
 		/** @var \OC\Group\Manager $groupManager */
854 854
 		$groupManager = self::$server->query(\OCP\IGroupManager::class);
855
-		$groupManager->listen('\OC\Group', 'postDelete', function (\OCP\IGroup $group) {
855
+		$groupManager->listen('\OC\Group', 'postDelete', function(\OCP\IGroup $group) {
856 856
 			$appManager = self::$server->getAppManager();
857 857
 			$apps = $appManager->getEnabledAppsForGroup($group);
858 858
 			foreach ($apps as $appId) {
@@ -962,11 +962,11 @@  discard block
 block discarded – undo
962 962
 		// emergency app disabling
963 963
 		if ($requestPath === '/disableapp'
964 964
 			&& $request->getMethod() === 'POST'
965
-			&& ((array)$request->getParam('appid')) !== ''
965
+			&& ((array) $request->getParam('appid')) !== ''
966 966
 		) {
967 967
 			\OC_JSON::callCheck();
968 968
 			\OC_JSON::checkAdminUser();
969
-			$appIds = (array)$request->getParam('appid');
969
+			$appIds = (array) $request->getParam('appid');
970 970
 			foreach ($appIds as $appId) {
971 971
 				$appId = \OC_App::cleanAppId($appId);
972 972
 				\OC::$server->getAppManager()->disableApp($appId);
Please login to merge, or discard this patch.