Completed
Push — master ( 345a0a...c0b31d )
by
unknown
23:52 queued 14s
created
tests/lib/InstallerTest.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		);
104 104
 
105 105
 		// Extract app
106
-		$pathOfTestApp = __DIR__ . '/../data/testapp.zip';
106
+		$pathOfTestApp = __DIR__.'/../data/testapp.zip';
107 107
 		$tar = new ZIP($pathOfTestApp);
108 108
 		$tar->extract($installer->getInstallPath());
109 109
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 			->method('get')
343 343
 			->willReturn($appArray);
344 344
 		$realTmpFile = Server::get(ITempManager::class)->getTemporaryFile('.tar.gz');
345
-		copy(__DIR__ . '/../data/testapp.tar.gz', $realTmpFile);
345
+		copy(__DIR__.'/../data/testapp.tar.gz', $realTmpFile);
346 346
 		$this->tempManager
347 347
 			->expects($this->once())
348 348
 			->method('getTemporaryFile')
@@ -420,14 +420,14 @@  discard block
 block discarded – undo
420 420
 			->method('get')
421 421
 			->willReturn($appArray);
422 422
 		$realTmpFile = Server::get(ITempManager::class)->getTemporaryFile('.tar.gz');
423
-		copy(__DIR__ . '/../data/testapp1.tar.gz', $realTmpFile);
423
+		copy(__DIR__.'/../data/testapp1.tar.gz', $realTmpFile);
424 424
 		$this->tempManager
425 425
 			->expects($this->once())
426 426
 			->method('getTemporaryFile')
427 427
 			->with('.tar.gz')
428 428
 			->willReturn($realTmpFile);
429 429
 		$realTmpFolder = Server::get(ITempManager::class)->getTemporaryFolder();
430
-		mkdir($realTmpFolder . '/testfolder');
430
+		mkdir($realTmpFolder.'/testfolder');
431 431
 		$this->tempManager
432 432
 			->expects($this->once())
433 433
 			->method('getTemporaryFolder')
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 			->method('get')
505 505
 			->willReturn($appArray);
506 506
 		$realTmpFile = Server::get(ITempManager::class)->getTemporaryFile('.tar.gz');
507
-		copy(__DIR__ . '/../data/testapp1.tar.gz', $realTmpFile);
507
+		copy(__DIR__.'/../data/testapp1.tar.gz', $realTmpFile);
508 508
 		$this->tempManager
509 509
 			->expects($this->once())
510 510
 			->method('getTemporaryFile')
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
 			->method('get')
584 584
 			->willReturn($appArray);
585 585
 		$realTmpFile = Server::get(ITempManager::class)->getTemporaryFile('.tar.gz');
586
-		copy(__DIR__ . '/../data/testapp.tar.gz', $realTmpFile);
586
+		copy(__DIR__.'/../data/testapp.tar.gz', $realTmpFile);
587 587
 		$this->tempManager
588 588
 			->expects($this->once())
589 589
 			->method('getTemporaryFile')
@@ -607,8 +607,8 @@  discard block
 block discarded – undo
607 607
 		$installer = $this->getInstaller();
608 608
 		$installer->downloadApp('testapp');
609 609
 
610
-		$this->assertTrue(file_exists(__DIR__ . '/../../apps/testapp/appinfo/info.xml'));
611
-		$this->assertEquals('0.9', \OC_App::getAppVersionByPath(__DIR__ . '/../../apps/testapp/'));
610
+		$this->assertTrue(file_exists(__DIR__.'/../../apps/testapp/appinfo/info.xml'));
611
+		$this->assertEquals('0.9', \OC_App::getAppVersionByPath(__DIR__.'/../../apps/testapp/'));
612 612
 	}
613 613
 
614 614
 
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
 			->method('get')
678 678
 			->willReturn($appArray);
679 679
 		$realTmpFile = Server::get(ITempManager::class)->getTemporaryFile('.tar.gz');
680
-		copy(__DIR__ . '/../data/testapp.0.8.tar.gz', $realTmpFile);
680
+		copy(__DIR__.'/../data/testapp.0.8.tar.gz', $realTmpFile);
681 681
 		$this->tempManager
682 682
 			->expects($this->once())
683 683
 			->method('getTemporaryFile')
@@ -697,12 +697,12 @@  discard block
 block discarded – undo
697 697
 			->expects($this->once())
698 698
 			->method('newClient')
699 699
 			->willReturn($client);
700
-		$this->assertTrue(file_exists(__DIR__ . '/../../apps/testapp/appinfo/info.xml'));
701
-		$this->assertEquals('0.9', \OC_App::getAppVersionByPath(__DIR__ . '/../../apps/testapp/'));
700
+		$this->assertTrue(file_exists(__DIR__.'/../../apps/testapp/appinfo/info.xml'));
701
+		$this->assertEquals('0.9', \OC_App::getAppVersionByPath(__DIR__.'/../../apps/testapp/'));
702 702
 
703 703
 		$installer = $this->getInstaller();
704 704
 		$installer->downloadApp('testapp');
705
-		$this->assertTrue(file_exists(__DIR__ . '/../../apps/testapp/appinfo/info.xml'));
706
-		$this->assertEquals('0.8', \OC_App::getAppVersionByPath(__DIR__ . '/../../apps/testapp/'));
705
+		$this->assertTrue(file_exists(__DIR__.'/../../apps/testapp/appinfo/info.xml'));
706
+		$this->assertEquals('0.8', \OC_App::getAppVersionByPath(__DIR__.'/../../apps/testapp/'));
707 707
 	}
708 708
 }
Please login to merge, or discard this patch.
lib/private/Installer.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -61,14 +61,14 @@  discard block
 block discarded – undo
61 61
 			throw new \Exception('App not found in any app directory');
62 62
 		}
63 63
 
64
-		$basedir = $app['path'] . '/' . $appId;
64
+		$basedir = $app['path'].'/'.$appId;
65 65
 
66
-		if (is_file($basedir . '/appinfo/database.xml')) {
67
-			throw new \Exception('The appinfo/database.xml file is not longer supported. Used in ' . $appId);
66
+		if (is_file($basedir.'/appinfo/database.xml')) {
67
+			throw new \Exception('The appinfo/database.xml file is not longer supported. Used in '.$appId);
68 68
 		}
69 69
 
70 70
 		$l = \OCP\Util::getL10N('core');
71
-		$info = \OCP\Server::get(IAppManager::class)->getAppInfoByPath($basedir . '/appinfo/info.xml', $l->getLanguageCode());
71
+		$info = \OCP\Server::get(IAppManager::class)->getAppInfoByPath($basedir.'/appinfo/info.xml', $l->getLanguageCode());
72 72
 
73 73
 		if (!is_array($info)) {
74 74
 			throw new \Exception(
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 		\OC_App::setupBackgroundJobs($info['background-jobs']);
115 115
 
116 116
 		//run appinfo/install.php
117
-		self::includeAppScript($basedir . '/appinfo/install.php');
117
+		self::includeAppScript($basedir.'/appinfo/install.php');
118 118
 
119 119
 		OC_App::executeRepairSteps($appId, $info['repair-steps']['install']);
120 120
 
@@ -125,10 +125,10 @@  discard block
 block discarded – undo
125 125
 
126 126
 		//set remote/public handlers
127 127
 		foreach ($info['remote'] as $name => $path) {
128
-			$config->setAppValue('core', 'remote_' . $name, $info['id'] . '/' . $path);
128
+			$config->setAppValue('core', 'remote_'.$name, $info['id'].'/'.$path);
129 129
 		}
130 130
 		foreach ($info['public'] as $name => $path) {
131
-			$config->setAppValue('core', 'public_' . $name, $info['id'] . '/' . $path);
131
+			$config->setAppValue('core', 'public_'.$name, $info['id'].'/'.$path);
132 132
 		}
133 133
 
134 134
 		OC_App::setAppTypes($info['id']);
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 			if ($app['id'] === $appId) {
214 214
 				// Load the certificate
215 215
 				$certificate = new X509();
216
-				$rootCrt = file_get_contents(__DIR__ . '/../../resources/codesigning/root.crt');
216
+				$rootCrt = file_get_contents(__DIR__.'/../../resources/codesigning/root.crt');
217 217
 				$rootCrts = $this->splitCerts($rootCrt);
218 218
 				foreach ($rootCrts as $rootCrt) {
219 219
 					$certificate->loadCA($rootCrt);
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 				foreach ($rootCrts as $rootCrt) {
226 226
 					$crl->loadCA($rootCrt);
227 227
 				}
228
-				$crl->loadCRL(file_get_contents(__DIR__ . '/../../resources/codesigning/root.crl'));
228
+				$crl->loadCRL(file_get_contents(__DIR__.'/../../resources/codesigning/root.crl'));
229 229
 				if ($crl->validateSignature() !== true) {
230 230
 					throw new \Exception('Could not validate CRL signature');
231 231
 				}
@@ -293,11 +293,11 @@  discard block
 block discarded – undo
293 293
 
294 294
 					$archive = new TAR($tempFile);
295 295
 					if (!$archive->extract($extractDir)) {
296
-						$errorMessage = 'Could not extract app ' . $appId;
296
+						$errorMessage = 'Could not extract app '.$appId;
297 297
 
298 298
 						$archiveError = $archive->getError();
299 299
 						if ($archiveError instanceof \PEAR_Error) {
300
-							$errorMessage .= ': ' . $archiveError->getMessage();
300
+							$errorMessage .= ': '.$archiveError->getMessage();
301 301
 						}
302 302
 
303 303
 						throw new \Exception($errorMessage);
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 					}
326 326
 
327 327
 					// Check if appinfo/info.xml has the same app ID as well
328
-					$xml = simplexml_load_string(file_get_contents($extractDir . '/' . $folders[0] . '/appinfo/info.xml'));
328
+					$xml = simplexml_load_string(file_get_contents($extractDir.'/'.$folders[0].'/appinfo/info.xml'));
329 329
 
330 330
 					if ($xml === false) {
331 331
 						throw new \Exception(
@@ -336,19 +336,19 @@  discard block
 block discarded – undo
336 336
 						);
337 337
 					}
338 338
 
339
-					if ((string)$xml->id !== $appId) {
339
+					if ((string) $xml->id !== $appId) {
340 340
 						throw new \Exception(
341 341
 							sprintf(
342 342
 								'App for id %s has a wrong app ID in info.xml: %s',
343 343
 								$appId,
344
-								(string)$xml->id
344
+								(string) $xml->id
345 345
 							)
346 346
 						);
347 347
 					}
348 348
 
349 349
 					// Check if the version is lower than before
350 350
 					$currentVersion = \OCP\Server::get(IAppManager::class)->getAppVersion($appId, true);
351
-					$newVersion = (string)$xml->version;
351
+					$newVersion = (string) $xml->version;
352 352
 					if (version_compare($currentVersion, $newVersion) === 1) {
353 353
 						throw new \Exception(
354 354
 							sprintf(
@@ -360,12 +360,12 @@  discard block
 block discarded – undo
360 360
 						);
361 361
 					}
362 362
 
363
-					$baseDir = $installPath . '/' . $appId;
363
+					$baseDir = $installPath.'/'.$appId;
364 364
 					// Remove old app with the ID if existent
365 365
 					Files::rmdirr($baseDir);
366 366
 					// Move to app folder
367 367
 					if (@mkdir($baseDir)) {
368
-						$extractDir .= '/' . $folders[0];
368
+						$extractDir .= '/'.$folders[0];
369 369
 					}
370 370
 					// otherwise we just copy the outer directory
371 371
 					$this->copyRecursive($extractDir, $baseDir);
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 	 * @param bool $allowUnstable
401 401
 	 * @return string|false false or the version number of the update
402 402
 	 */
403
-	public function isUpdateAvailable($appId, $allowUnstable = false): string|false {
403
+	public function isUpdateAvailable($appId, $allowUnstable = false): string | false {
404 404
 		if ($this->isInstanceReadyForUpdates === null) {
405 405
 			$installPath = $this->getInstallPath();
406 406
 			if ($installPath === null) {
@@ -451,8 +451,8 @@  discard block
 block discarded – undo
451 451
 		if ($app === false) {
452 452
 			return false;
453 453
 		}
454
-		$basedir = $app['path'] . '/' . $appId;
455
-		return file_exists($basedir . '/.git/');
454
+		$basedir = $app['path'].'/'.$appId;
455
+		return file_exists($basedir.'/.git/');
456 456
 	}
457 457
 
458 458
 	/**
@@ -496,11 +496,11 @@  discard block
 block discarded – undo
496 496
 				$this->logger->error('No application directories are marked as writable.', ['app' => 'core']);
497 497
 				return false;
498 498
 			}
499
-			$appDir = $installPath . '/' . $appId;
499
+			$appDir = $installPath.'/'.$appId;
500 500
 			Files::rmdirr($appDir);
501 501
 			return true;
502 502
 		} else {
503
-			$this->logger->error('can\'t remove app ' . $appId . '. It is not installed.');
503
+			$this->logger->error('can\'t remove app '.$appId.'. It is not installed.');
504 504
 
505 505
 			return false;
506 506
 		}
@@ -544,8 +544,8 @@  discard block
 block discarded – undo
544 544
 		foreach (\OC::$APPSROOTS as $app_dir) {
545 545
 			if ($dir = opendir($app_dir['path'])) {
546 546
 				while (false !== ($filename = readdir($dir))) {
547
-					if ($filename[0] !== '.' and is_dir($app_dir['path'] . "/$filename")) {
548
-						if (file_exists($app_dir['path'] . "/$filename/appinfo/info.xml")) {
547
+					if ($filename[0] !== '.' and is_dir($app_dir['path']."/$filename")) {
548
+						if (file_exists($app_dir['path']."/$filename/appinfo/info.xml")) {
549 549
 							if ($config->getAppValue($filename, 'installed_version', null) === null) {
550 550
 								$enabled = $appManager->isDefaultEnabled($filename);
551 551
 								if (($enabled || in_array($filename, $appManager->getAlwaysEnabledApps()))
@@ -579,9 +579,9 @@  discard block
 block discarded – undo
579 579
 	/**
580 580
 	 * install an app already placed in the app folder
581 581
 	 */
582
-	public static function installShippedApp(string $app, ?IOutput $output = null): string|false {
582
+	public static function installShippedApp(string $app, ?IOutput $output = null): string | false {
583 583
 		if ($output instanceof IOutput) {
584
-			$output->debug('Installing ' . $app);
584
+			$output->debug('Installing '.$app);
585 585
 		}
586 586
 
587 587
 		$appManager = \OCP\Server::get(IAppManager::class);
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
 			return false;
606 606
 		}
607 607
 		if ($output instanceof IOutput) {
608
-			$output->debug('Registering tasks of ' . $app);
608
+			$output->debug('Registering tasks of '.$app);
609 609
 		}
610 610
 		\OC_App::setupBackgroundJobs($info['background-jobs']);
611 611
 
@@ -618,10 +618,10 @@  discard block
 block discarded – undo
618 618
 
619 619
 		//set remote/public handlers
620 620
 		foreach ($info['remote'] as $name => $path) {
621
-			$config->setAppValue('core', 'remote_' . $name, $app . '/' . $path);
621
+			$config->setAppValue('core', 'remote_'.$name, $app.'/'.$path);
622 622
 		}
623 623
 		foreach ($info['public'] as $name => $path) {
624
-			$config->setAppValue('core', 'public_' . $name, $app . '/' . $path);
624
+			$config->setAppValue('core', 'public_'.$name, $app.'/'.$path);
625 625
 		}
626 626
 
627 627
 		OC_App::setAppTypes($info['id']);
Please login to merge, or discard this patch.