Passed
Push — master ( 9af8c0...c15172 )
by Roeland
15:34 queued 11s
created
lib/private/Installer.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 
116 116
 		$basedir = $app['path'].'/'.$appId;
117 117
 
118
-		if (is_file($basedir . '/appinfo/database.xml')) {
119
-			throw new \Exception('The appinfo/database.xml file is not longer supported. Used in ' . $appId);
118
+		if (is_file($basedir.'/appinfo/database.xml')) {
119
+			throw new \Exception('The appinfo/database.xml file is not longer supported. Used in '.$appId);
120 120
 		}
121 121
 
122 122
 		$info = OC_App::getAppInfo($basedir.'/appinfo/info.xml', true);
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		\OC_App::setupBackgroundJobs($info['background-jobs']);
168 168
 
169 169
 		//run appinfo/install.php
170
-		self::includeAppScript($basedir . '/appinfo/install.php');
170
+		self::includeAppScript($basedir.'/appinfo/install.php');
171 171
 
172 172
 		$appData = OC_App::getAppInfo($appId);
173 173
 		OC_App::executeRepairSteps($appId, $appData['repair-steps']['install']);
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 			if ($app['id'] === $appId) {
242 242
 				// Load the certificate
243 243
 				$certificate = new X509();
244
-				$rootCrt = file_get_contents(__DIR__ . '/../../resources/codesigning/root.crt');
244
+				$rootCrt = file_get_contents(__DIR__.'/../../resources/codesigning/root.crt');
245 245
 				$rootCrts = $this->splitCerts($rootCrt);
246 246
 				foreach ($rootCrts as $rootCrt) {
247 247
 					$certificate->loadCA($rootCrt);
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 				foreach ($rootCrts as $rootCrt) {
254 254
 					$crl->loadCA($rootCrt);
255 255
 				}
256
-				$crl->loadCRL(file_get_contents(__DIR__ . '/../../resources/codesigning/root.crl'));
256
+				$crl->loadCRL(file_get_contents(__DIR__.'/../../resources/codesigning/root.crl'));
257 257
 				if ($crl->validateSignature() !== true) {
258 258
 					throw new \Exception('Could not validate CRL signature');
259 259
 				}
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 
307 307
 				// Check if the signature actually matches the downloaded content
308 308
 				$certificate = openssl_get_publickey($app['certificate']);
309
-				$verified = (bool)openssl_verify(file_get_contents($tempFile), base64_decode($app['releases'][0]['signature']), $certificate, OPENSSL_ALGO_SHA512);
309
+				$verified = (bool) openssl_verify(file_get_contents($tempFile), base64_decode($app['releases'][0]['signature']), $certificate, OPENSSL_ALGO_SHA512);
310 310
 				openssl_free_key($certificate);
311 311
 
312 312
 				if ($verified === true) {
@@ -316,11 +316,11 @@  discard block
 block discarded – undo
316 316
 
317 317
 					if ($archive) {
318 318
 						if (!$archive->extract($extractDir)) {
319
-							$errorMessage = 'Could not extract app ' . $appId;
319
+							$errorMessage = 'Could not extract app '.$appId;
320 320
 
321 321
 							$archiveError = $archive->getError();
322 322
 							if ($archiveError instanceof \PEAR_Error) {
323
-								$errorMessage .= ': ' . $archiveError->getMessage();
323
+								$errorMessage .= ': '.$archiveError->getMessage();
324 324
 							}
325 325
 
326 326
 							throw new \Exception($errorMessage);
@@ -340,21 +340,21 @@  discard block
 block discarded – undo
340 340
 
341 341
 						// Check if appinfo/info.xml has the same app ID as well
342 342
 						$loadEntities = libxml_disable_entity_loader(false);
343
-						$xml = simplexml_load_file($extractDir . '/' . $folders[0] . '/appinfo/info.xml');
343
+						$xml = simplexml_load_file($extractDir.'/'.$folders[0].'/appinfo/info.xml');
344 344
 						libxml_disable_entity_loader($loadEntities);
345
-						if ((string)$xml->id !== $appId) {
345
+						if ((string) $xml->id !== $appId) {
346 346
 							throw new \Exception(
347 347
 								sprintf(
348 348
 									'App for id %s has a wrong app ID in info.xml: %s',
349 349
 									$appId,
350
-									(string)$xml->id
350
+									(string) $xml->id
351 351
 								)
352 352
 							);
353 353
 						}
354 354
 
355 355
 						// Check if the version is lower than before
356 356
 						$currentVersion = OC_App::getAppVersion($appId);
357
-						$newVersion = (string)$xml->version;
357
+						$newVersion = (string) $xml->version;
358 358
 						if (version_compare($currentVersion, $newVersion) === 1) {
359 359
 							throw new \Exception(
360 360
 								sprintf(
@@ -366,12 +366,12 @@  discard block
 block discarded – undo
366 366
 							);
367 367
 						}
368 368
 
369
-						$baseDir = OC_App::getInstallPath() . '/' . $appId;
369
+						$baseDir = OC_App::getInstallPath().'/'.$appId;
370 370
 						// Remove old app with the ID if existent
371 371
 						OC_Helper::rmdirr($baseDir);
372 372
 						// Move to app folder
373 373
 						if (@mkdir($baseDir)) {
374
-							$extractDir .= '/' . $folders[0];
374
+							$extractDir .= '/'.$folders[0];
375 375
 							OC_Helper::copyr($extractDir, $baseDir);
376 376
 						}
377 377
 						OC_Helper::copyr($extractDir, $baseDir);
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
 			if (\OC::$server->getAppManager()->isShipped($appId)) {
511 511
 				return false;
512 512
 			}
513
-			$appDir = OC_App::getInstallPath() . '/' . $appId;
513
+			$appDir = OC_App::getInstallPath().'/'.$appId;
514 514
 			OC_Helper::rmdirr($appDir);
515 515
 			return true;
516 516
 		} else {
Please login to merge, or discard this patch.
lib/private/legacy/OC_App.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 		$coordinator = \OC::$server->query(Coordinator::class);
164 164
 		$isBootable = $coordinator->isBootable($app);
165 165
 
166
-		$hasAppPhpFile = is_file($appPath . '/appinfo/app.php');
166
+		$hasAppPhpFile = is_file($appPath.'/appinfo/app.php');
167 167
 
168 168
 		if ($isBootable && $hasAppPhpFile) {
169 169
 			\OC::$server->getLogger()->error('/appinfo/app.php is not loaded when \OCP\AppFramework\Bootstrap\IBootstrap on the application class is used. Migrate everything from app.php to the Application class.', [
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 			\OC::$server->getLogger()->debug('/appinfo/app.php is deprecated, use \OCP\AppFramework\Bootstrap\IBootstrap on the application class instead.', [
174 174
 				'app' => $app,
175 175
 			]);
176
-			\OC::$server->getEventLogger()->start('load_app_' . $app, 'Load app: ' . $app);
176
+			\OC::$server->getEventLogger()->start('load_app_'.$app, 'Load app: '.$app);
177 177
 			try {
178 178
 				self::requireAppFile($app);
179 179
 			} catch (Throwable $ex) {
@@ -182,18 +182,18 @@  discard block
 block discarded – undo
182 182
 				}
183 183
 				if (!\OC::$server->getAppManager()->isShipped($app) && !self::isType($app, ['authentication'])) {
184 184
 					\OC::$server->getLogger()->logException($ex, [
185
-						'message' => "App $app threw an error during app.php load and will be disabled: " . $ex->getMessage(),
185
+						'message' => "App $app threw an error during app.php load and will be disabled: ".$ex->getMessage(),
186 186
 					]);
187 187
 
188 188
 					// Only disable apps which are not shipped and that are not authentication apps
189 189
 					\OC::$server->getAppManager()->disableApp($app, true);
190 190
 				} else {
191 191
 					\OC::$server->getLogger()->logException($ex, [
192
-						'message' => "App $app threw an error during app.php load: " . $ex->getMessage(),
192
+						'message' => "App $app threw an error during app.php load: ".$ex->getMessage(),
193 193
 					]);
194 194
 				}
195 195
 			}
196
-			\OC::$server->getEventLogger()->end('load_app_' . $app);
196
+			\OC::$server->getEventLogger()->end('load_app_'.$app);
197 197
 		}
198 198
 		$coordinator->bootApp($app);
199 199
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	 * @param bool $force
261 261
 	 */
262 262
 	public static function registerAutoloading(string $app, string $path, bool $force = false) {
263
-		$key = $app . '-' . $path;
263
+		$key = $app.'-'.$path;
264 264
 		if (!$force && isset(self::$alreadyRegistered[$key])) {
265 265
 			return;
266 266
 		}
@@ -271,17 +271,17 @@  discard block
 block discarded – undo
271 271
 		$appNamespace = \OC\AppFramework\App::buildAppNamespace($app);
272 272
 		\OC::$server->registerNamespace($app, $appNamespace);
273 273
 
274
-		if (file_exists($path . '/composer/autoload.php')) {
275
-			require_once $path . '/composer/autoload.php';
274
+		if (file_exists($path.'/composer/autoload.php')) {
275
+			require_once $path.'/composer/autoload.php';
276 276
 		} else {
277
-			\OC::$composerAutoloader->addPsr4($appNamespace . '\\', $path . '/lib/', true);
277
+			\OC::$composerAutoloader->addPsr4($appNamespace.'\\', $path.'/lib/', true);
278 278
 			// Register on legacy autoloader
279 279
 			\OC::$loader->addValidRoot($path);
280 280
 		}
281 281
 
282 282
 		// Register Test namespace only when testing
283 283
 		if (defined('PHPUNIT_RUN') || defined('CLI_TEST_RUN')) {
284
-			\OC::$composerAutoloader->addPsr4($appNamespace . '\\Tests\\', $path . '/tests/', true);
284
+			\OC::$composerAutoloader->addPsr4($appNamespace.'\\Tests\\', $path.'/tests/', true);
285 285
 		}
286 286
 	}
287 287
 
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 	 */
294 294
 	private static function requireAppFile(string $app) {
295 295
 		// encapsulated here to avoid variable scope conflicts
296
-		require_once $app . '/appinfo/app.php';
296
+		require_once $app.'/appinfo/app.php';
297 297
 	}
298 298
 
299 299
 	/**
@@ -386,8 +386,8 @@  discard block
 block discarded – undo
386 386
 		} else {
387 387
 			$apps = $appManager->getEnabledAppsForUser($user);
388 388
 		}
389
-		$apps = array_filter($apps, function ($app) {
390
-			return $app !== 'files';//we add this manually
389
+		$apps = array_filter($apps, function($app) {
390
+			return $app !== 'files'; //we add this manually
391 391
 		});
392 392
 		sort($apps);
393 393
 		array_unshift($apps, 'files');
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 
488 488
 		$possibleApps = [];
489 489
 		foreach (OC::$APPSROOTS as $dir) {
490
-			if (file_exists($dir['path'] . '/' . $appId)) {
490
+			if (file_exists($dir['path'].'/'.$appId)) {
491 491
 				$possibleApps[] = $dir;
492 492
 			}
493 493
 		}
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
 		} else {
502 502
 			$versionToLoad = [];
503 503
 			foreach ($possibleApps as $possibleApp) {
504
-				$version = self::getAppVersionByPath($possibleApp['path'] . '/' . $appId);
504
+				$version = self::getAppVersionByPath($possibleApp['path'].'/'.$appId);
505 505
 				if (empty($versionToLoad) || version_compare($version, $versionToLoad['version'], '>')) {
506 506
 					$versionToLoad = [
507 507
 						'dir' => $possibleApp,
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
 		}
532 532
 
533 533
 		if (($dir = self::findAppInDirectories($appId)) != false) {
534
-			return $dir['path'] . '/' . $appId;
534
+			return $dir['path'].'/'.$appId;
535 535
 		}
536 536
 		return false;
537 537
 	}
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 	 */
547 547
 	public static function getAppWebPath(string $appId) {
548 548
 		if (($dir = self::findAppInDirectories($appId)) != false) {
549
-			return OC::$WEBROOT . $dir['url'] . '/' . $appId;
549
+			return OC::$WEBROOT.$dir['url'].'/'.$appId;
550 550
 		}
551 551
 		return false;
552 552
 	}
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
 	 * @return string
571 571
 	 */
572 572
 	public static function getAppVersionByPath(string $path): string {
573
-		$infoFile = $path . '/appinfo/info.xml';
573
+		$infoFile = $path.'/appinfo/info.xml';
574 574
 		$appData = \OC::$server->getAppManager()->getAppInfo($infoFile, true);
575 575
 		return isset($appData['version']) ? $appData['version'] : '';
576 576
 	}
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
 	 * @param string $page
671 671
 	 */
672 672
 	public static function registerAdmin(string $app, string $page) {
673
-		self::$adminForms[] = $app . '/' . $page . '.php';
673
+		self::$adminForms[] = $app.'/'.$page.'.php';
674 674
 	}
675 675
 
676 676
 	/**
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
 	 * @param string $page
680 680
 	 */
681 681
 	public static function registerPersonal(string $app, string $page) {
682
-		self::$personalForms[] = $app . '/' . $page . '.php';
682
+		self::$personalForms[] = $app.'/'.$page.'.php';
683 683
 	}
684 684
 
685 685
 	/**
@@ -750,14 +750,14 @@  discard block
 block discarded – undo
750 750
 
751 751
 		foreach (OC::$APPSROOTS as $apps_dir) {
752 752
 			if (!is_readable($apps_dir['path'])) {
753
-				\OCP\Util::writeLog('core', 'unable to read app folder : ' . $apps_dir['path'], ILogger::WARN);
753
+				\OCP\Util::writeLog('core', 'unable to read app folder : '.$apps_dir['path'], ILogger::WARN);
754 754
 				continue;
755 755
 			}
756 756
 			$dh = opendir($apps_dir['path']);
757 757
 
758 758
 			if (is_resource($dh)) {
759 759
 				while (($file = readdir($dh)) !== false) {
760
-					if ($file[0] != '.' and is_dir($apps_dir['path'] . '/' . $file) and is_file($apps_dir['path'] . '/' . $file . '/appinfo/info.xml')) {
760
+					if ($file[0] != '.' and is_dir($apps_dir['path'].'/'.$file) and is_file($apps_dir['path'].'/'.$file.'/appinfo/info.xml')) {
761 761
 						$apps[] = $file;
762 762
 					}
763 763
 				}
@@ -791,12 +791,12 @@  discard block
 block discarded – undo
791 791
 			if (array_search($app, $blacklist) === false) {
792 792
 				$info = OC_App::getAppInfo($app, false, $langCode);
793 793
 				if (!is_array($info)) {
794
-					\OCP\Util::writeLog('core', 'Could not read app info file for app "' . $app . '"', ILogger::ERROR);
794
+					\OCP\Util::writeLog('core', 'Could not read app info file for app "'.$app.'"', ILogger::ERROR);
795 795
 					continue;
796 796
 				}
797 797
 
798 798
 				if (!isset($info['name'])) {
799
-					\OCP\Util::writeLog('core', 'App id "' . $app . '" has no name in appinfo', ILogger::ERROR);
799
+					\OCP\Util::writeLog('core', 'App id "'.$app.'" has no name in appinfo', ILogger::ERROR);
800 800
 					continue;
801 801
 				}
802 802
 
@@ -828,12 +828,12 @@  discard block
 block discarded – undo
828 828
 
829 829
 				$appPath = self::getAppPath($app);
830 830
 				if ($appPath !== false) {
831
-					$appIcon = $appPath . '/img/' . $app . '.svg';
831
+					$appIcon = $appPath.'/img/'.$app.'.svg';
832 832
 					if (file_exists($appIcon)) {
833
-						$info['preview'] = $urlGenerator->imagePath($app, $app . '.svg');
833
+						$info['preview'] = $urlGenerator->imagePath($app, $app.'.svg');
834 834
 						$info['previewAsIcon'] = true;
835 835
 					} else {
836
-						$appIcon = $appPath . '/img/app.svg';
836
+						$appIcon = $appPath.'/img/app.svg';
837 837
 						if (file_exists($appIcon)) {
838 838
 							$info['preview'] = $urlGenerator->imagePath($app, 'app.svg');
839 839
 							$info['previewAsIcon'] = true;
@@ -972,8 +972,8 @@  discard block
 block discarded – undo
972 972
 			return false;
973 973
 		}
974 974
 
975
-		if (is_file($appPath . '/appinfo/database.xml')) {
976
-			\OC::$server->getLogger()->error('The appinfo/database.xml file is not longer supported. Used in ' . $appId);
975
+		if (is_file($appPath.'/appinfo/database.xml')) {
976
+			\OC::$server->getLogger()->error('The appinfo/database.xml file is not longer supported. Used in '.$appId);
977 977
 			return false;
978 978
 		}
979 979
 
@@ -1010,10 +1010,10 @@  discard block
 block discarded – undo
1010 1010
 			\OC::$server->getConfig()->deleteAppValue($appId, 'ocsid');
1011 1011
 		}
1012 1012
 		foreach ($appData['remote'] as $name => $path) {
1013
-			\OC::$server->getConfig()->setAppValue('core', 'remote_' . $name, $appId . '/' . $path);
1013
+			\OC::$server->getConfig()->setAppValue('core', 'remote_'.$name, $appId.'/'.$path);
1014 1014
 		}
1015 1015
 		foreach ($appData['public'] as $name => $path) {
1016
-			\OC::$server->getConfig()->setAppValue('core', 'public_' . $name, $appId . '/' . $path);
1016
+			\OC::$server->getConfig()->setAppValue('core', 'public_'.$name, $appId.'/'.$path);
1017 1017
 		}
1018 1018
 
1019 1019
 		self::setAppTypes($appId);
@@ -1083,17 +1083,17 @@  discard block
 block discarded – undo
1083 1083
 	public static function getStorage(string $appId) {
1084 1084
 		if (\OC::$server->getAppManager()->isEnabledForUser($appId)) { //sanity check
1085 1085
 			if (\OC::$server->getUserSession()->isLoggedIn()) {
1086
-				$view = new \OC\Files\View('/' . OC_User::getUser());
1086
+				$view = new \OC\Files\View('/'.OC_User::getUser());
1087 1087
 				if (!$view->file_exists($appId)) {
1088 1088
 					$view->mkdir($appId);
1089 1089
 				}
1090
-				return new \OC\Files\View('/' . OC_User::getUser() . '/' . $appId);
1090
+				return new \OC\Files\View('/'.OC_User::getUser().'/'.$appId);
1091 1091
 			} else {
1092
-				\OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ', user not logged in', ILogger::ERROR);
1092
+				\OCP\Util::writeLog('core', 'Can\'t get app storage, app '.$appId.', user not logged in', ILogger::ERROR);
1093 1093
 				return false;
1094 1094
 			}
1095 1095
 		} else {
1096
-			\OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ' not enabled', ILogger::ERROR);
1096
+			\OCP\Util::writeLog('core', 'Can\'t get app storage, app '.$appId.' not enabled', ILogger::ERROR);
1097 1097
 			return false;
1098 1098
 		}
1099 1099
 	}
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
 
1131 1131
 				if ($attributeLang === $similarLang) {
1132 1132
 					$similarLangFallback = $option['@value'];
1133
-				} elseif (strpos($attributeLang, $similarLang . '_') === 0) {
1133
+				} elseif (strpos($attributeLang, $similarLang.'_') === 0) {
1134 1134
 					if ($similarLangFallback === false) {
1135 1135
 						$similarLangFallback = $option['@value'];
1136 1136
 					}
Please login to merge, or discard this patch.