Completed
Push — master ( c93919...f057a2 )
by Robin
31:21 queued 16s
created
lib/private/legacy/OC_Util.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 		/** @var LoggerInterface $logger */
125 125
 		$logger = \OC::$server->get(LoggerInterface::class);
126 126
 
127
-		$plainSkeletonDirectory = \OC::$server->getConfig()->getSystemValueString('skeletondirectory', \OC::$SERVERROOT . '/core/skeleton');
127
+		$plainSkeletonDirectory = \OC::$server->getConfig()->getSystemValueString('skeletondirectory', \OC::$SERVERROOT.'/core/skeleton');
128 128
 		$userLang = \OC::$server->get(IFactory::class)->findLanguage();
129 129
 		$skeletonDirectory = str_replace('{lang}', $userLang, $plainSkeletonDirectory);
130 130
 
@@ -146,13 +146,13 @@  discard block
 block discarded – undo
146 146
 		if ($instanceId === null) {
147 147
 			throw new \RuntimeException('no instance id!');
148 148
 		}
149
-		$appdata = 'appdata_' . $instanceId;
149
+		$appdata = 'appdata_'.$instanceId;
150 150
 		if ($userId === $appdata) {
151
-			throw new \RuntimeException('username is reserved name: ' . $appdata);
151
+			throw new \RuntimeException('username is reserved name: '.$appdata);
152 152
 		}
153 153
 
154 154
 		if (!empty($skeletonDirectory)) {
155
-			$logger->debug('copying skeleton for ' . $userId . ' from ' . $skeletonDirectory . ' to ' . $userDirectory->getFullPath('/'), ['app' => 'files_skeleton']);
155
+			$logger->debug('copying skeleton for '.$userId.' from '.$skeletonDirectory.' to '.$userDirectory->getFullPath('/'), ['app' => 'files_skeleton']);
156 156
 			self::copyr($skeletonDirectory, $userDirectory);
157 157
 			// update the file cache
158 158
 			$userDirectory->getStorage()->getScanner()->scan('', \OC\Files\Cache\Scanner::SCAN_RECURSIVE);
@@ -183,13 +183,13 @@  discard block
 block discarded – undo
183 183
 		// Copy the files
184 184
 		while (false !== ($file = readdir($dir))) {
185 185
 			if (!\OC\Files\Filesystem::isIgnoredDir($file)) {
186
-				if (is_dir($source . '/' . $file)) {
186
+				if (is_dir($source.'/'.$file)) {
187 187
 					$child = $target->newFolder($file);
188
-					self::copyr($source . '/' . $file, $child);
188
+					self::copyr($source.'/'.$file, $child);
189 189
 				} else {
190
-					$sourceStream = fopen($source . '/' . $file, 'r');
190
+					$sourceStream = fopen($source.'/'.$file, 'r');
191 191
 					if ($sourceStream === false) {
192
-						$logger->error(sprintf('Could not fopen "%s"', $source . '/' . $file), ['app' => 'core']);
192
+						$logger->error(sprintf('Could not fopen "%s"', $source.'/'.$file), ['app' => 'core']);
193 193
 						closedir($dir);
194 194
 						return;
195 195
 					}
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 	public static function checkServer(\OC\SystemConfig $config) {
305 305
 		$l = \OC::$server->getL10N('lib');
306 306
 		$errors = [];
307
-		$CONFIG_DATADIRECTORY = $config->getValue('datadirectory', OC::$SERVERROOT . '/data');
307
+		$CONFIG_DATADIRECTORY = $config->getValue('datadirectory', OC::$SERVERROOT.'/data');
308 308
 
309 309
 		if (!self::needUpgrade($config) && $config->getValue('installed', false)) {
310 310
 			// this check needs to be done every time
@@ -331,14 +331,14 @@  discard block
 block discarded – undo
331 331
 		}
332 332
 
333 333
 		// Check if config folder is writable.
334
-		if (!(bool)$config->getValue('config_is_read_only', false)) {
334
+		if (!(bool) $config->getValue('config_is_read_only', false)) {
335 335
 			if (!is_writable(OC::$configDir) or !is_readable(OC::$configDir)) {
336 336
 				$errors[] = [
337 337
 					'error' => $l->t('Cannot write into "config" directory.'),
338 338
 					'hint' => $l->t('This can usually be fixed by giving the web server write access to the config directory. See %s',
339
-						[ $urlGenerator->linkToDocs('admin-dir_permissions') ]) . '. '
339
+						[$urlGenerator->linkToDocs('admin-dir_permissions')]).'. '
340 340
 						. $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',
341
-							[ $urlGenerator->linkToDocs('admin-config') ])
341
+							[$urlGenerator->linkToDocs('admin-config')])
342 342
 				];
343 343
 			}
344 344
 		}
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 			];
563 563
 		}
564 564
 
565
-		if (!file_exists($dataDirectory . '/.ncdata')) {
565
+		if (!file_exists($dataDirectory.'/.ncdata')) {
566 566
 			$errors[] = [
567 567
 				'error' => $l->t('Your data directory is invalid.'),
568 568
 				'hint' => $l->t('Ensure there is a file called "%1$s" in the root of the data directory. It should have the content: "%2$s"', ['.ncdata', '# Nextcloud data directory']),
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
 	public static function checkLoggedIn(): void {
581 581
 		// Check if we are a user
582 582
 		if (!\OC::$server->getUserSession()->isLoggedIn()) {
583
-			header('Location: ' . \OC::$server->getURLGenerator()->linkToRoute(
583
+			header('Location: '.\OC::$server->getURLGenerator()->linkToRoute(
584 584
 				'core.login.showLoginForm',
585 585
 				[
586 586
 					'redirect_url' => \OC::$server->getRequest()->getRequestUri(),
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 		}
592 592
 		// Redirect to 2FA challenge selection if 2FA challenge was not solved yet
593 593
 		if (\OC::$server->get(TwoFactorAuthManager::class)->needsSecondFactor(\OC::$server->getUserSession()->getUser())) {
594
-			header('Location: ' . \OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.selectChallenge'));
594
+			header('Location: '.\OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.selectChallenge'));
595 595
 			exit();
596 596
 		}
597 597
 	}
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
 	public static function checkAdminUser(): void {
605 605
 		self::checkLoggedIn();
606 606
 		if (!OC_User::isAdminUser(OC_User::getUser())) {
607
-			header('Location: ' . \OCP\Util::linkToAbsolute('', 'index.php'));
607
+			header('Location: '.\OCP\Util::linkToAbsolute('', 'index.php'));
608 608
 			exit();
609 609
 		}
610 610
 	}
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
 	 */
631 631
 	public static function redirectToDefaultPage(): void {
632 632
 		$location = self::getDefaultPageUrl();
633
-		header('Location: ' . $location);
633
+		header('Location: '.$location);
634 634
 		exit();
635 635
 	}
636 636
 
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
 		$id = \OC::$server->getSystemConfig()->getValue('instanceid', null);
644 644
 		if (is_null($id)) {
645 645
 			// We need to guarantee at least one letter in instanceid so it can be used as the session_name
646
-			$id = 'oc' . \OC::$server->get(ISecureRandom::class)->generate(10, \OCP\Security\ISecureRandom::CHAR_LOWER . \OCP\Security\ISecureRandom::CHAR_DIGITS);
646
+			$id = 'oc'.\OC::$server->get(ISecureRandom::class)->generate(10, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_DIGITS);
647 647
 			\OC::$server->getSystemConfig()->setValue('instanceid', $id);
648 648
 		}
649 649
 		return $id;
@@ -661,12 +661,12 @@  discard block
 block discarded – undo
661 661
 	 */
662 662
 	public static function sanitizeHTML($value) {
663 663
 		if (is_array($value)) {
664
-			$value = array_map(function ($value) {
664
+			$value = array_map(function($value) {
665 665
 				return self::sanitizeHTML($value);
666 666
 			}, $value);
667 667
 		} else {
668 668
 			// Specify encoding for PHP<5.4
669
-			$value = htmlspecialchars((string)$value, ENT_QUOTES, 'UTF-8');
669
+			$value = htmlspecialchars((string) $value, ENT_QUOTES, 'UTF-8');
670 670
 		}
671 671
 		return $value;
672 672
 	}
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
 		$theme = \OC::$server->getSystemConfig()->getValue('theme', '');
781 781
 
782 782
 		if ($theme === '') {
783
-			if (is_dir(OC::$SERVERROOT . '/themes/default')) {
783
+			if (is_dir(OC::$SERVERROOT.'/themes/default')) {
784 784
 				$theme = 'default';
785 785
 			}
786 786
 		}
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 
802 802
 		$normalizedValue = Normalizer::normalize($value);
803 803
 		if ($normalizedValue === false) {
804
-			\OCP\Server::get(LoggerInterface::class)->warning('normalizing failed for "' . $value . '"', ['app' => 'core']);
804
+			\OCP\Server::get(LoggerInterface::class)->warning('normalizing failed for "'.$value.'"', ['app' => 'core']);
805 805
 			return $value;
806 806
 		}
807 807
 
@@ -828,19 +828,19 @@  discard block
 block discarded – undo
828 828
 			} elseif ($config->getValue('debug', false) && $versionDiff < 0) {
829 829
 				// downgrade with debug
830 830
 				$installedMajor = explode('.', $installedVersion);
831
-				$installedMajor = $installedMajor[0] . '.' . $installedMajor[1];
831
+				$installedMajor = $installedMajor[0].'.'.$installedMajor[1];
832 832
 				$currentMajor = explode('.', $currentVersion);
833
-				$currentMajor = $currentMajor[0] . '.' . $currentMajor[1];
833
+				$currentMajor = $currentMajor[0].'.'.$currentMajor[1];
834 834
 				if ($installedMajor === $currentMajor) {
835 835
 					// Same major, allow downgrade for developers
836 836
 					return true;
837 837
 				} else {
838 838
 					// downgrade attempt, throw exception
839
-					throw new \OCP\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from ' . $installedVersion . ' to ' . $currentVersion . ')');
839
+					throw new \OCP\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from '.$installedVersion.' to '.$currentVersion.')');
840 840
 				}
841 841
 			} elseif ($versionDiff < 0) {
842 842
 				// downgrade attempt, throw exception
843
-				throw new \OCP\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from ' . $installedVersion . ' to ' . $currentVersion . ')');
843
+				throw new \OCP\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from '.$installedVersion.' to '.$currentVersion.')');
844 844
 			}
845 845
 
846 846
 			// also check for upgrades for apps (independently from the user)
Please login to merge, or discard this patch.