Passed
Push — master ( f452e2...9c2d70 )
by Roeland
10:46 queued 10s
created
lib/private/Updater.php 1 patch
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -101,19 +101,19 @@  discard block
 block discarded – undo
101 101
 		$this->logAllEvents();
102 102
 
103 103
 		$logLevel = $this->config->getSystemValue('loglevel', ILogger::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', ILogger::DEBUG);
106 106
 
107 107
 		$wasMaintenanceModeEnabled = $this->config->getSystemValueBool('maintenance');
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
 		// Clear CAN_INSTALL file if not on git
115 115
 		if (\OC_Util::getChannel() !== 'git' && is_file(\OC::$configDir.'/CAN_INSTALL')) {
116
-			if (!unlink(\OC::$configDir . '/CAN_INSTALL')) {
116
+			if (!unlink(\OC::$configDir.'/CAN_INSTALL')) {
117 117
 				$this->log->error('Could not cleanup CAN_INSTALL from your config folder. Please remove this file manually.');
118 118
 			}
119 119
 		}
@@ -121,31 +121,31 @@  discard block
 block discarded – undo
121 121
 		$installedVersion = $this->config->getSystemValue('version', '0.0.0');
122 122
 		$currentVersion = implode('.', \OCP\Util::getVersion());
123 123
 
124
-		$this->log->debug('starting upgrade from ' . $installedVersion . ' to ' . $currentVersion, array('app' => 'core'));
124
+		$this->log->debug('starting upgrade from '.$installedVersion.' to '.$currentVersion, array('app' => 'core'));
125 125
 
126 126
 		$success = true;
127 127
 		try {
128 128
 			$this->doUpgrade($currentVersion, $installedVersion);
129 129
 		} catch (HintException $exception) {
130 130
 			$this->log->logException($exception, ['app' => 'core']);
131
-			$this->emit('\OC\Updater', 'failure', array($exception->getMessage() . ': ' .$exception->getHint()));
131
+			$this->emit('\OC\Updater', 'failure', array($exception->getMessage().': '.$exception->getHint()));
132 132
 			$success = false;
133 133
 		} catch (\Exception $exception) {
134 134
 			$this->log->logException($exception, ['app' => 'core']);
135
-			$this->emit('\OC\Updater', 'failure', array(get_class($exception) . ': ' .$exception->getMessage()));
135
+			$this->emit('\OC\Updater', 'failure', array(get_class($exception).': '.$exception->getMessage()));
136 136
 			$success = false;
137 137
 		}
138 138
 
139 139
 		$this->emit('\OC\Updater', 'updateEnd', array($success));
140 140
 
141
-		if(!$wasMaintenanceModeEnabled && $success) {
141
+		if (!$wasMaintenanceModeEnabled && $success) {
142 142
 			$this->config->setSystemValue('maintenance', false);
143 143
 			$this->emit('\OC\Updater', 'maintenanceDisabled');
144 144
 		} else {
145 145
 			$this->emit('\OC\Updater', 'maintenanceActive');
146 146
 		}
147 147
 
148
-		$this->emit('\OC\Updater', 'resetLogLevel', [ $logLevel, $this->logLevelNames[$logLevel] ]);
148
+		$this->emit('\OC\Updater', 'resetLogLevel', [$logLevel, $this->logLevelNames[$logLevel]]);
149 149
 		$this->config->setSystemValue('loglevel', $logLevel);
150 150
 		$this->config->setSystemValue('installed', true);
151 151
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	 */
160 160
 	private function getAllowedPreviousVersions() {
161 161
 		// this should really be a JSON file
162
-		require \OC::$SERVERROOT . '/version.php';
162
+		require \OC::$SERVERROOT.'/version.php';
163 163
 		/** @var array $OC_VersionCanBeUpgradedFrom */
164 164
 		return $OC_VersionCanBeUpgradedFrom;
165 165
 	}
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 	 */
172 172
 	private function getVendor() {
173 173
 		// this should really be a JSON file
174
-		require \OC::$SERVERROOT . '/version.php';
174
+		require \OC::$SERVERROOT.'/version.php';
175 175
 		/** @var string $vendor */
176 176
 		return (string) $vendor;
177 177
 	}
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 	 */
186 186
 	public function isUpgradePossible($oldVersion, $newVersion, array $allowedPreviousVersions) {
187 187
 		$version = explode('.', $oldVersion);
188
-		$majorMinor = $version[0] . '.' . $version[1];
188
+		$majorMinor = $version[0].'.'.$version[1];
189 189
 
190 190
 		$currentVendor = $this->config->getAppValue('core', 'vendor', '');
191 191
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 		// create empty file in data dir, so we can later find
233 233
 		// out that this is indeed an ownCloud data directory
234 234
 		// (in case it didn't exist before)
235
-		file_put_contents($this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/.ocdata', '');
235
+		file_put_contents($this->config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').'/.ocdata', '');
236 236
 
237 237
 		// pre-upgrade repairs
238 238
 		$repair = new Repair(Repair::getBeforeUpgradeRepairSteps(), \OC::$server->getEventDispatcher());
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 		foreach ($errors as $appId => $exception) {
266 266
 			/** @var \Exception $exception */
267 267
 			$this->log->logException($exception, ['app' => $appId]);
268
-			$this->emit('\OC\Updater', 'failure', [$appId . ': ' . $exception->getMessage()]);
268
+			$this->emit('\OC\Updater', 'failure', [$appId.': '.$exception->getMessage()]);
269 269
 		}
270 270
 
271 271
 		// post-upgrade repairs
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 		$this->config->setAppValue('core', 'lastupdatedat', 0);
277 277
 
278 278
 		// Check for code integrity if not disabled
279
-		if(\OC::$server->getIntegrityCodeChecker()->isCodeCheckEnforced()) {
279
+		if (\OC::$server->getIntegrityCodeChecker()->isCodeCheckEnforced()) {
280 280
 			$this->emit('\OC\Updater', 'startCheckCodeIntegrity');
281 281
 			$this->checker->runInstanceVerification();
282 282
 			$this->emit('\OC\Updater', 'finishedCheckCodeIntegrity');
@@ -317,12 +317,12 @@  discard block
 block discarded – undo
317 317
 				 * @link https://github.com/owncloud/core/issues/10980
318 318
 				 * @see \OC_App::updateApp
319 319
 				 */
320
-				if (file_exists(\OC_App::getAppPath($appId) . '/appinfo/preupdate.php')) {
320
+				if (file_exists(\OC_App::getAppPath($appId).'/appinfo/preupdate.php')) {
321 321
 					$this->includePreUpdate($appId);
322 322
 				}
323
-				if (file_exists(\OC_App::getAppPath($appId) . '/appinfo/database.xml')) {
323
+				if (file_exists(\OC_App::getAppPath($appId).'/appinfo/database.xml')) {
324 324
 					$this->emit('\OC\Updater', 'appSimulateUpdate', array($appId));
325
-					\OC_DB::simulateUpdateDbFromStructure(\OC_App::getAppPath($appId) . '/appinfo/database.xml');
325
+					\OC_DB::simulateUpdateDbFromStructure(\OC_App::getAppPath($appId).'/appinfo/database.xml');
326 326
 				}
327 327
 			}
328 328
 		}
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 	 * @param string $appId
336 336
 	 */
337 337
 	private function includePreUpdate($appId) {
338
-		include \OC_App::getAppPath($appId) . '/appinfo/preupdate.php';
338
+		include \OC_App::getAppPath($appId).'/appinfo/preupdate.php';
339 339
 	}
340 340
 
341 341
 	/**
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 		foreach ($apps as $appId) {
354 354
 			$priorityType = false;
355 355
 			foreach ($priorityTypes as $type) {
356
-				if(!isset($stacks[$type])) {
356
+				if (!isset($stacks[$type])) {
357 357
 					$stacks[$type] = array();
358 358
 				}
359 359
 				if (\OC_App::isType($appId, [$type])) {
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 					\OC_App::updateApp($appId);
374 374
 					$this->emit('\OC\Updater', 'appUpgrade', [$appId, \OC_App::getAppVersion($appId)]);
375 375
 				}
376
-				if($type !== $pseudoOtherType) {
376
+				if ($type !== $pseudoOtherType) {
377 377
 					// load authentication, filesystem and logging apps after
378 378
 					// upgrading them. Other apps my need to rely on modifying
379 379
 					// user and/or filesystem aspects.
@@ -401,9 +401,9 @@  discard block
 block discarded – undo
401 401
 		foreach ($apps as $app) {
402 402
 			// check if the app is compatible with this version of ownCloud
403 403
 			$info = OC_App::getAppInfo($app);
404
-			if($info === null || !OC_App::isAppCompatible($version, $info)) {
404
+			if ($info === null || !OC_App::isAppCompatible($version, $info)) {
405 405
 				if ($appManager->isShipped($app)) {
406
-					throw new \UnexpectedValueException('The files of the app "' . $app . '" were not correctly replaced before running the update');
406
+					throw new \UnexpectedValueException('The files of the app "'.$app.'" were not correctly replaced before running the update');
407 407
 				}
408 408
 				\OC::$server->getAppManager()->disableApp($app, true);
409 409
 				$this->emit('\OC\Updater', 'incompatibleAppDisabled', array($app));
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 	 * @throws \Exception
443 443
 	 */
444 444
 	private function upgradeAppStoreApps(array $disabledApps, $reenable = false) {
445
-		foreach($disabledApps as $app) {
445
+		foreach ($disabledApps as $app) {
446 446
 			try {
447 447
 				$this->emit('\OC\Updater', 'checkAppStoreAppBefore', [$app]);
448 448
 				if ($this->installer->isUpdateAvailable($app)) {
@@ -466,22 +466,22 @@  discard block
 block discarded – undo
466 466
 	 */
467 467
 	private function emitRepairEvents() {
468 468
 		$dispatcher = \OC::$server->getEventDispatcher();
469
-		$dispatcher->addListener('\OC\Repair::warning', function ($event) {
469
+		$dispatcher->addListener('\OC\Repair::warning', function($event) {
470 470
 			if ($event instanceof GenericEvent) {
471 471
 				$this->emit('\OC\Updater', 'repairWarning', $event->getArguments());
472 472
 			}
473 473
 		});
474
-		$dispatcher->addListener('\OC\Repair::error', function ($event) {
474
+		$dispatcher->addListener('\OC\Repair::error', function($event) {
475 475
 			if ($event instanceof GenericEvent) {
476 476
 				$this->emit('\OC\Updater', 'repairError', $event->getArguments());
477 477
 			}
478 478
 		});
479
-		$dispatcher->addListener('\OC\Repair::info', function ($event) {
479
+		$dispatcher->addListener('\OC\Repair::info', function($event) {
480 480
 			if ($event instanceof GenericEvent) {
481 481
 				$this->emit('\OC\Updater', 'repairInfo', $event->getArguments());
482 482
 			}
483 483
 		});
484
-		$dispatcher->addListener('\OC\Repair::step', function ($event) {
484
+		$dispatcher->addListener('\OC\Repair::step', function($event) {
485 485
 			if ($event instanceof GenericEvent) {
486 486
 				$this->emit('\OC\Updater', 'repairStep', $event->getArguments());
487 487
 			}
@@ -496,13 +496,13 @@  discard block
 block discarded – undo
496 496
 			if (!$event instanceof GenericEvent) {
497 497
 				return;
498 498
 			}
499
-			$log->info('\OC\DB\Migrator::executeSql: ' . $event->getSubject() . ' (' . $event->getArgument(0) . ' of ' . $event->getArgument(1) . ')', ['app' => 'updater']);
499
+			$log->info('\OC\DB\Migrator::executeSql: '.$event->getSubject().' ('.$event->getArgument(0).' of '.$event->getArgument(1).')', ['app' => 'updater']);
500 500
 		});
501 501
 		$dispatcher->addListener('\OC\DB\Migrator::checkTable', function($event) use ($log) {
502 502
 			if (!$event instanceof GenericEvent) {
503 503
 				return;
504 504
 			}
505
-			$log->info('\OC\DB\Migrator::checkTable: ' . $event->getSubject() . ' (' . $event->getArgument(0) . ' of ' . $event->getArgument(1) . ')', ['app' => 'updater']);
505
+			$log->info('\OC\DB\Migrator::checkTable: '.$event->getSubject().' ('.$event->getArgument(0).' of '.$event->getArgument(1).')', ['app' => 'updater']);
506 506
 		});
507 507
 
508 508
 		$repairListener = function($event) use ($log) {
@@ -511,30 +511,30 @@  discard block
 block discarded – undo
511 511
 			}
512 512
 			switch ($event->getSubject()) {
513 513
 				case '\OC\Repair::startProgress':
514
-					$log->info('\OC\Repair::startProgress: Starting ... ' . $event->getArgument(1) .  ' (' . $event->getArgument(0) . ')', ['app' => 'updater']);
514
+					$log->info('\OC\Repair::startProgress: Starting ... '.$event->getArgument(1).' ('.$event->getArgument(0).')', ['app' => 'updater']);
515 515
 					break;
516 516
 				case '\OC\Repair::advance':
517 517
 					$desc = $event->getArgument(1);
518 518
 					if (empty($desc)) {
519 519
 						$desc = '';
520 520
 					}
521
-					$log->info('\OC\Repair::advance: ' . $desc . ' (' . $event->getArgument(0) . ')', ['app' => 'updater']);
521
+					$log->info('\OC\Repair::advance: '.$desc.' ('.$event->getArgument(0).')', ['app' => 'updater']);
522 522
 
523 523
 					break;
524 524
 				case '\OC\Repair::finishProgress':
525 525
 					$log->info('\OC\Repair::finishProgress', ['app' => 'updater']);
526 526
 					break;
527 527
 				case '\OC\Repair::step':
528
-					$log->info('\OC\Repair::step: Repair step: ' . $event->getArgument(0), ['app' => 'updater']);
528
+					$log->info('\OC\Repair::step: Repair step: '.$event->getArgument(0), ['app' => 'updater']);
529 529
 					break;
530 530
 				case '\OC\Repair::info':
531
-					$log->info('\OC\Repair::info: Repair info: ' . $event->getArgument(0), ['app' => 'updater']);
531
+					$log->info('\OC\Repair::info: Repair info: '.$event->getArgument(0), ['app' => 'updater']);
532 532
 					break;
533 533
 				case '\OC\Repair::warning':
534
-					$log->warning('\OC\Repair::warning: Repair warning: ' . $event->getArgument(0), ['app' => 'updater']);
534
+					$log->warning('\OC\Repair::warning: Repair warning: '.$event->getArgument(0), ['app' => 'updater']);
535 535
 					break;
536 536
 				case '\OC\Repair::error':
537
-					$log->error('\OC\Repair::error: Repair error: ' . $event->getArgument(0), ['app' => 'updater']);
537
+					$log->error('\OC\Repair::error: Repair error: '.$event->getArgument(0), ['app' => 'updater']);
538 538
 					break;
539 539
 			}
540 540
 		};
@@ -548,74 +548,74 @@  discard block
 block discarded – undo
548 548
 		$dispatcher->addListener('\OC\Repair::error', $repairListener);
549 549
 
550 550
 
551
-		$this->listen('\OC\Updater', 'maintenanceEnabled', function () use($log) {
551
+		$this->listen('\OC\Updater', 'maintenanceEnabled', function() use($log) {
552 552
 			$log->info('\OC\Updater::maintenanceEnabled: Turned on maintenance mode', ['app' => 'updater']);
553 553
 		});
554
-		$this->listen('\OC\Updater', 'maintenanceDisabled', function () use($log) {
554
+		$this->listen('\OC\Updater', 'maintenanceDisabled', function() use($log) {
555 555
 			$log->info('\OC\Updater::maintenanceDisabled: Turned off maintenance mode', ['app' => 'updater']);
556 556
 		});
557
-		$this->listen('\OC\Updater', 'maintenanceActive', function () use($log) {
557
+		$this->listen('\OC\Updater', 'maintenanceActive', function() use($log) {
558 558
 			$log->info('\OC\Updater::maintenanceActive: Maintenance mode is kept active', ['app' => 'updater']);
559 559
 		});
560
-		$this->listen('\OC\Updater', 'updateEnd', function ($success) use($log) {
560
+		$this->listen('\OC\Updater', 'updateEnd', function($success) use($log) {
561 561
 			if ($success) {
562 562
 				$log->info('\OC\Updater::updateEnd: Update successful', ['app' => 'updater']);
563 563
 			} else {
564 564
 				$log->error('\OC\Updater::updateEnd: Update failed', ['app' => 'updater']);
565 565
 			}
566 566
 		});
567
-		$this->listen('\OC\Updater', 'dbUpgradeBefore', function () use($log) {
567
+		$this->listen('\OC\Updater', 'dbUpgradeBefore', function() use($log) {
568 568
 			$log->info('\OC\Updater::dbUpgradeBefore: Updating database schema', ['app' => 'updater']);
569 569
 		});
570
-		$this->listen('\OC\Updater', 'dbUpgrade', function () use($log) {
570
+		$this->listen('\OC\Updater', 'dbUpgrade', function() use($log) {
571 571
 			$log->info('\OC\Updater::dbUpgrade: Updated database', ['app' => 'updater']);
572 572
 		});
573
-		$this->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function () use($log) {
573
+		$this->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function() use($log) {
574 574
 			$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']);
575 575
 		});
576
-		$this->listen('\OC\Updater', 'dbSimulateUpgrade', function () use($log) {
576
+		$this->listen('\OC\Updater', 'dbSimulateUpgrade', function() use($log) {
577 577
 			$log->info('\OC\Updater::dbSimulateUpgrade: Checked database schema update', ['app' => 'updater']);
578 578
 		});
579
-		$this->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use($log) {
580
-			$log->info('\OC\Updater::incompatibleAppDisabled: Disabled incompatible app: ' . $app, ['app' => 'updater']);
579
+		$this->listen('\OC\Updater', 'incompatibleAppDisabled', function($app) use($log) {
580
+			$log->info('\OC\Updater::incompatibleAppDisabled: Disabled incompatible app: '.$app, ['app' => 'updater']);
581 581
 		});
582
-		$this->listen('\OC\Updater', 'checkAppStoreAppBefore', function ($app) use($log) {
583
-			$log->info('\OC\Updater::checkAppStoreAppBefore: Checking for update of app "' . $app . '" in appstore', ['app' => 'updater']);
582
+		$this->listen('\OC\Updater', 'checkAppStoreAppBefore', function($app) use($log) {
583
+			$log->info('\OC\Updater::checkAppStoreAppBefore: Checking for update of app "'.$app.'" in appstore', ['app' => 'updater']);
584 584
 		});
585
-		$this->listen('\OC\Updater', 'upgradeAppStoreApp', function ($app) use($log) {
586
-			$log->info('\OC\Updater::upgradeAppStoreApp: Update app "' . $app . '" from appstore', ['app' => 'updater']);
585
+		$this->listen('\OC\Updater', 'upgradeAppStoreApp', function($app) use($log) {
586
+			$log->info('\OC\Updater::upgradeAppStoreApp: Update app "'.$app.'" from appstore', ['app' => 'updater']);
587 587
 		});
588
-		$this->listen('\OC\Updater', 'checkAppStoreApp', function ($app) use($log) {
589
-			$log->info('\OC\Updater::checkAppStoreApp: Checked for update of app "' . $app . '" in appstore', ['app' => 'updater']);
588
+		$this->listen('\OC\Updater', 'checkAppStoreApp', function($app) use($log) {
589
+			$log->info('\OC\Updater::checkAppStoreApp: Checked for update of app "'.$app.'" in appstore', ['app' => 'updater']);
590 590
 		});
591
-		$this->listen('\OC\Updater', 'appUpgradeCheckBefore', function () use ($log) {
591
+		$this->listen('\OC\Updater', 'appUpgradeCheckBefore', function() use ($log) {
592 592
 			$log->info('\OC\Updater::appUpgradeCheckBefore: Checking updates of apps', ['app' => 'updater']);
593 593
 		});
594
-		$this->listen('\OC\Updater', 'appSimulateUpdate', function ($app) use ($log) {
595
-			$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']);
594
+		$this->listen('\OC\Updater', 'appSimulateUpdate', function($app) use ($log) {
595
+			$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']);
596 596
 		});
597
-		$this->listen('\OC\Updater', 'appUpgradeCheck', function () use ($log) {
597
+		$this->listen('\OC\Updater', 'appUpgradeCheck', function() use ($log) {
598 598
 			$log->info('\OC\Updater::appUpgradeCheck: Checked database schema update for apps', ['app' => 'updater']);
599 599
 		});
600
-		$this->listen('\OC\Updater', 'appUpgradeStarted', function ($app) use ($log) {
601
-			$log->info('\OC\Updater::appUpgradeStarted: Updating <' . $app . '> ...', ['app' => 'updater']);
600
+		$this->listen('\OC\Updater', 'appUpgradeStarted', function($app) use ($log) {
601
+			$log->info('\OC\Updater::appUpgradeStarted: Updating <'.$app.'> ...', ['app' => 'updater']);
602 602
 		});
603
-		$this->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($log) {
604
-			$log->info('\OC\Updater::appUpgrade: Updated <' . $app . '> to ' . $version, ['app' => 'updater']);
603
+		$this->listen('\OC\Updater', 'appUpgrade', function($app, $version) use ($log) {
604
+			$log->info('\OC\Updater::appUpgrade: Updated <'.$app.'> to '.$version, ['app' => 'updater']);
605 605
 		});
606
-		$this->listen('\OC\Updater', 'failure', function ($message) use($log) {
607
-			$log->error('\OC\Updater::failure: ' . $message, ['app' => 'updater']);
606
+		$this->listen('\OC\Updater', 'failure', function($message) use($log) {
607
+			$log->error('\OC\Updater::failure: '.$message, ['app' => 'updater']);
608 608
 		});
609
-		$this->listen('\OC\Updater', 'setDebugLogLevel', function () use($log) {
609
+		$this->listen('\OC\Updater', 'setDebugLogLevel', function() use($log) {
610 610
 			$log->info('\OC\Updater::setDebugLogLevel: Set log level to debug', ['app' => 'updater']);
611 611
 		});
612
-		$this->listen('\OC\Updater', 'resetLogLevel', function ($logLevel, $logLevelName) use($log) {
613
-			$log->info('\OC\Updater::resetLogLevel: Reset log level to ' . $logLevelName . '(' . $logLevel . ')', ['app' => 'updater']);
612
+		$this->listen('\OC\Updater', 'resetLogLevel', function($logLevel, $logLevelName) use($log) {
613
+			$log->info('\OC\Updater::resetLogLevel: Reset log level to '.$logLevelName.'('.$logLevel.')', ['app' => 'updater']);
614 614
 		});
615
-		$this->listen('\OC\Updater', 'startCheckCodeIntegrity', function () use($log) {
615
+		$this->listen('\OC\Updater', 'startCheckCodeIntegrity', function() use($log) {
616 616
 			$log->info('\OC\Updater::startCheckCodeIntegrity: Starting code integrity check...', ['app' => 'updater']);
617 617
 		});
618
-		$this->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function () use($log) {
618
+		$this->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function() use($log) {
619 619
 			$log->info('\OC\Updater::finishedCheckCodeIntegrity: Finished code integrity check', ['app' => 'updater']);
620 620
 		});
621 621
 
Please login to merge, or discard this patch.
lib/private/legacy/app.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -113,9 +113,9 @@  discard block
 block discarded – undo
113 113
 		$apps = self::getEnabledApps();
114 114
 
115 115
 		// Add each apps' folder as allowed class path
116
-		foreach($apps as $app) {
116
+		foreach ($apps as $app) {
117 117
 			$path = self::getAppPath($app);
118
-			if($path !== false) {
118
+			if ($path !== false) {
119 119
 				self::registerAutoloading($app, $path);
120 120
 			}
121 121
 		}
@@ -141,15 +141,15 @@  discard block
 block discarded – undo
141 141
 	public static function loadApp(string $app) {
142 142
 		self::$loadedApps[] = $app;
143 143
 		$appPath = self::getAppPath($app);
144
-		if($appPath === false) {
144
+		if ($appPath === false) {
145 145
 			return;
146 146
 		}
147 147
 
148 148
 		// in case someone calls loadApp() directly
149 149
 		self::registerAutoloading($app, $appPath);
150 150
 
151
-		if (is_file($appPath . '/appinfo/app.php')) {
152
-			\OC::$server->getEventLogger()->start('load_app_' . $app, 'Load app: ' . $app);
151
+		if (is_file($appPath.'/appinfo/app.php')) {
152
+			\OC::$server->getEventLogger()->start('load_app_'.$app, 'Load app: '.$app);
153 153
 			try {
154 154
 				self::requireAppFile($app);
155 155
 			} catch (Throwable $ex) {
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 					\OC::$server->getAppManager()->disableApp($app, true);
160 160
 				}
161 161
 			}
162
-			\OC::$server->getEventLogger()->end('load_app_' . $app);
162
+			\OC::$server->getEventLogger()->end('load_app_'.$app);
163 163
 		}
164 164
 
165 165
 		$info = self::getAppInfo($app);
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 			$plugins = isset($info['collaboration']['plugins']['plugin']['@value']) ?
206 206
 				[$info['collaboration']['plugins']['plugin']] : $info['collaboration']['plugins']['plugin'];
207 207
 			foreach ($plugins as $plugin) {
208
-				if($plugin['@attributes']['type'] === 'collaborator-search') {
208
+				if ($plugin['@attributes']['type'] === 'collaborator-search') {
209 209
 					$pluginInfo = [
210 210
 						'shareType' => $plugin['@attributes']['share-type'],
211 211
 						'class' => $plugin['@value'],
@@ -224,8 +224,8 @@  discard block
 block discarded – undo
224 224
 	 * @param string $path
225 225
 	 */
226 226
 	public static function registerAutoloading(string $app, string $path) {
227
-		$key = $app . '-' . $path;
228
-		if(isset(self::$alreadyRegistered[$key])) {
227
+		$key = $app.'-'.$path;
228
+		if (isset(self::$alreadyRegistered[$key])) {
229 229
 			return;
230 230
 		}
231 231
 
@@ -235,17 +235,17 @@  discard block
 block discarded – undo
235 235
 		$appNamespace = \OC\AppFramework\App::buildAppNamespace($app);
236 236
 		\OC::$server->registerNamespace($app, $appNamespace);
237 237
 
238
-		if (file_exists($path . '/composer/autoload.php')) {
239
-			require_once $path . '/composer/autoload.php';
238
+		if (file_exists($path.'/composer/autoload.php')) {
239
+			require_once $path.'/composer/autoload.php';
240 240
 		} else {
241
-			\OC::$composerAutoloader->addPsr4($appNamespace . '\\', $path . '/lib/', true);
241
+			\OC::$composerAutoloader->addPsr4($appNamespace.'\\', $path.'/lib/', true);
242 242
 			// Register on legacy autoloader
243 243
 			\OC::$loader->addValidRoot($path);
244 244
 		}
245 245
 
246 246
 		// Register Test namespace only when testing
247 247
 		if (defined('PHPUNIT_RUN') || defined('CLI_TEST_RUN')) {
248
-			\OC::$composerAutoloader->addPsr4($appNamespace . '\\Tests\\', $path . '/tests/', true);
248
+			\OC::$composerAutoloader->addPsr4($appNamespace.'\\Tests\\', $path.'/tests/', true);
249 249
 		}
250 250
 	}
251 251
 
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 	 */
258 258
 	private static function requireAppFile(string $app) {
259 259
 		// encapsulated here to avoid variable scope conflicts
260
-		require_once $app . '/appinfo/app.php';
260
+		require_once $app.'/appinfo/app.php';
261 261
 	}
262 262
 
263 263
 	/**
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 	public static function setAppTypes(string $app) {
303 303
 		$appManager = \OC::$server->getAppManager();
304 304
 		$appData = $appManager->getAppInfo($app);
305
-		if(!is_array($appData)) {
305
+		if (!is_array($appData)) {
306 306
 			return;
307 307
 		}
308 308
 
@@ -350,8 +350,8 @@  discard block
 block discarded – undo
350 350
 		} else {
351 351
 			$apps = $appManager->getEnabledAppsForUser($user);
352 352
 		}
353
-		$apps = array_filter($apps, function ($app) {
354
-			return $app !== 'files';//we add this manually
353
+		$apps = array_filter($apps, function($app) {
354
+			return $app !== 'files'; //we add this manually
355 355
 		});
356 356
 		sort($apps);
357 357
 		array_unshift($apps, 'files');
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 		$installer = \OC::$server->query(Installer::class);
390 390
 		$isDownloaded = $installer->isDownloaded($appId);
391 391
 
392
-		if(!$isDownloaded) {
392
+		if (!$isDownloaded) {
393 393
 			$installer->downloadApp($appId);
394 394
 		}
395 395
 
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 	 */
441 441
 	public static function findAppInDirectories(string $appId) {
442 442
 		$sanitizedAppId = self::cleanAppId($appId);
443
-		if($sanitizedAppId !== $appId) {
443
+		if ($sanitizedAppId !== $appId) {
444 444
 			return false;
445 445
 		}
446 446
 		static $app_dir = [];
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 
452 452
 		$possibleApps = [];
453 453
 		foreach (OC::$APPSROOTS as $dir) {
454
-			if (file_exists($dir['path'] . '/' . $appId)) {
454
+			if (file_exists($dir['path'].'/'.$appId)) {
455 455
 				$possibleApps[] = $dir;
456 456
 			}
457 457
 		}
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 		} else {
466 466
 			$versionToLoad = [];
467 467
 			foreach ($possibleApps as $possibleApp) {
468
-				$version = self::getAppVersionByPath($possibleApp['path'] . '/' . $appId);
468
+				$version = self::getAppVersionByPath($possibleApp['path'].'/'.$appId);
469 469
 				if (empty($versionToLoad) || version_compare($version, $versionToLoad['version'], '>')) {
470 470
 					$versionToLoad = array(
471 471
 						'dir' => $possibleApp,
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
 		}
493 493
 
494 494
 		if (($dir = self::findAppInDirectories($appId)) != false) {
495
-			return $dir['path'] . '/' . $appId;
495
+			return $dir['path'].'/'.$appId;
496 496
 		}
497 497
 		return false;
498 498
 	}
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
 	 */
507 507
 	public static function getAppWebPath(string $appId) {
508 508
 		if (($dir = self::findAppInDirectories($appId)) != false) {
509
-			return OC::$WEBROOT . $dir['url'] . '/' . $appId;
509
+			return OC::$WEBROOT.$dir['url'].'/'.$appId;
510 510
 		}
511 511
 		return false;
512 512
 	}
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 	 * @return string
531 531
 	 */
532 532
 	public static function getAppVersionByPath(string $path): string {
533
-		$infoFile = $path . '/appinfo/info.xml';
533
+		$infoFile = $path.'/appinfo/info.xml';
534 534
 		$appData = \OC::$server->getAppManager()->getAppInfo($infoFile, true);
535 535
 		return isset($appData['version']) ? $appData['version'] : '';
536 536
 	}
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
 	 * @param string $page
631 631
 	 */
632 632
 	public static function registerAdmin(string $app, string $page) {
633
-		self::$adminForms[] = $app . '/' . $page . '.php';
633
+		self::$adminForms[] = $app.'/'.$page.'.php';
634 634
 	}
635 635
 
636 636
 	/**
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
 	 * @param string $page
640 640
 	 */
641 641
 	public static function registerPersonal(string $app, string $page) {
642
-		self::$personalForms[] = $app . '/' . $page . '.php';
642
+		self::$personalForms[] = $app.'/'.$page.'.php';
643 643
 	}
644 644
 
645 645
 	/**
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
 
669 669
 		foreach (OC::$APPSROOTS as $apps_dir) {
670 670
 			if (!is_readable($apps_dir['path'])) {
671
-				\OCP\Util::writeLog('core', 'unable to read app folder : ' . $apps_dir['path'], ILogger::WARN);
671
+				\OCP\Util::writeLog('core', 'unable to read app folder : '.$apps_dir['path'], ILogger::WARN);
672 672
 				continue;
673 673
 			}
674 674
 			$dh = opendir($apps_dir['path']);
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
 			if (is_resource($dh)) {
677 677
 				while (($file = readdir($dh)) !== false) {
678 678
 
679
-					if ($file[0] != '.' and is_dir($apps_dir['path'] . '/' . $file) and is_file($apps_dir['path'] . '/' . $file . '/appinfo/info.xml')) {
679
+					if ($file[0] != '.' and is_dir($apps_dir['path'].'/'.$file) and is_file($apps_dir['path'].'/'.$file.'/appinfo/info.xml')) {
680 680
 
681 681
 						$apps[] = $file;
682 682
 					}
@@ -712,12 +712,12 @@  discard block
 block discarded – undo
712 712
 
713 713
 				$info = OC_App::getAppInfo($app, false, $langCode);
714 714
 				if (!is_array($info)) {
715
-					\OCP\Util::writeLog('core', 'Could not read app info file for app "' . $app . '"', ILogger::ERROR);
715
+					\OCP\Util::writeLog('core', 'Could not read app info file for app "'.$app.'"', ILogger::ERROR);
716 716
 					continue;
717 717
 				}
718 718
 
719 719
 				if (!isset($info['name'])) {
720
-					\OCP\Util::writeLog('core', 'App id "' . $app . '" has no name in appinfo', ILogger::ERROR);
720
+					\OCP\Util::writeLog('core', 'App id "'.$app.'" has no name in appinfo', ILogger::ERROR);
721 721
 					continue;
722 722
 				}
723 723
 
@@ -748,13 +748,13 @@  discard block
 block discarded – undo
748 748
 				}
749 749
 
750 750
 				$appPath = self::getAppPath($app);
751
-				if($appPath !== false) {
752
-					$appIcon = $appPath . '/img/' . $app . '.svg';
751
+				if ($appPath !== false) {
752
+					$appIcon = $appPath.'/img/'.$app.'.svg';
753 753
 					if (file_exists($appIcon)) {
754
-						$info['preview'] = $urlGenerator->imagePath($app, $app . '.svg');
754
+						$info['preview'] = $urlGenerator->imagePath($app, $app.'.svg');
755 755
 						$info['previewAsIcon'] = true;
756 756
 					} else {
757
-						$appIcon = $appPath . '/img/app.svg';
757
+						$appIcon = $appPath.'/img/app.svg';
758 758
 						if (file_exists($appIcon)) {
759 759
 							$info['preview'] = $urlGenerator->imagePath($app, 'app.svg');
760 760
 							$info['previewAsIcon'] = true;
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
 	public static function getAppVersions() {
876 876
 		static $versions;
877 877
 
878
-		if(!$versions) {
878
+		if (!$versions) {
879 879
 			$appConfig = \OC::$server->getAppConfig();
880 880
 			$versions = $appConfig->getValues(false, 'installed_version');
881 881
 		}
@@ -890,7 +890,7 @@  discard block
 block discarded – undo
890 890
 	 */
891 891
 	public static function updateApp(string $appId): bool {
892 892
 		$appPath = self::getAppPath($appId);
893
-		if($appPath === false) {
893
+		if ($appPath === false) {
894 894
 			return false;
895 895
 		}
896 896
 		self::registerAutoloading($appId, $appPath);
@@ -899,8 +899,8 @@  discard block
 block discarded – undo
899 899
 		$appData = self::getAppInfo($appId);
900 900
 		self::executeRepairSteps($appId, $appData['repair-steps']['pre-migration']);
901 901
 
902
-		if (file_exists($appPath . '/appinfo/database.xml')) {
903
-			OC_DB::updateDbFromStructure($appPath . '/appinfo/database.xml');
902
+		if (file_exists($appPath.'/appinfo/database.xml')) {
903
+			OC_DB::updateDbFromStructure($appPath.'/appinfo/database.xml');
904 904
 		} else {
905 905
 			$ms = new MigrationService($appId, \OC::$server->getDatabaseConnection());
906 906
 			$ms->migrate();
@@ -913,23 +913,23 @@  discard block
 block discarded – undo
913 913
 		\OC::$server->getAppManager()->getAppVersion($appId, false);
914 914
 
915 915
 		// run upgrade code
916
-		if (file_exists($appPath . '/appinfo/update.php')) {
916
+		if (file_exists($appPath.'/appinfo/update.php')) {
917 917
 			self::loadApp($appId);
918
-			include $appPath . '/appinfo/update.php';
918
+			include $appPath.'/appinfo/update.php';
919 919
 		}
920 920
 		self::setupBackgroundJobs($appData['background-jobs']);
921 921
 
922 922
 		//set remote/public handlers
923 923
 		if (array_key_exists('ocsid', $appData)) {
924 924
 			\OC::$server->getConfig()->setAppValue($appId, 'ocsid', $appData['ocsid']);
925
-		} elseif(\OC::$server->getConfig()->getAppValue($appId, 'ocsid', null) !== null) {
925
+		} elseif (\OC::$server->getConfig()->getAppValue($appId, 'ocsid', null) !== null) {
926 926
 			\OC::$server->getConfig()->deleteAppValue($appId, 'ocsid');
927 927
 		}
928 928
 		foreach ($appData['remote'] as $name => $path) {
929
-			\OC::$server->getConfig()->setAppValue('core', 'remote_' . $name, $appId . '/' . $path);
929
+			\OC::$server->getConfig()->setAppValue('core', 'remote_'.$name, $appId.'/'.$path);
930 930
 		}
931 931
 		foreach ($appData['public'] as $name => $path) {
932
-			\OC::$server->getConfig()->setAppValue('core', 'public_' . $name, $appId . '/' . $path);
932
+			\OC::$server->getConfig()->setAppValue('core', 'public_'.$name, $appId.'/'.$path);
933 933
 		}
934 934
 
935 935
 		self::setAppTypes($appId);
@@ -999,17 +999,17 @@  discard block
 block discarded – undo
999 999
 	public static function getStorage(string $appId) {
1000 1000
 		if (\OC::$server->getAppManager()->isEnabledForUser($appId)) { //sanity check
1001 1001
 			if (\OC::$server->getUserSession()->isLoggedIn()) {
1002
-				$view = new \OC\Files\View('/' . OC_User::getUser());
1002
+				$view = new \OC\Files\View('/'.OC_User::getUser());
1003 1003
 				if (!$view->file_exists($appId)) {
1004 1004
 					$view->mkdir($appId);
1005 1005
 				}
1006
-				return new \OC\Files\View('/' . OC_User::getUser() . '/' . $appId);
1006
+				return new \OC\Files\View('/'.OC_User::getUser().'/'.$appId);
1007 1007
 			} else {
1008
-				\OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ', user not logged in', ILogger::ERROR);
1008
+				\OCP\Util::writeLog('core', 'Can\'t get app storage, app '.$appId.', user not logged in', ILogger::ERROR);
1009 1009
 				return false;
1010 1010
 			}
1011 1011
 		} else {
1012
-			\OCP\Util::writeLog('core', 'Can\'t get app storage, app ' . $appId . ' not enabled', ILogger::ERROR);
1012
+			\OCP\Util::writeLog('core', 'Can\'t get app storage, app '.$appId.' not enabled', ILogger::ERROR);
1013 1013
 			return false;
1014 1014
 		}
1015 1015
 	}
@@ -1046,9 +1046,9 @@  discard block
 block discarded – undo
1046 1046
 
1047 1047
 				if ($attributeLang === $similarLang) {
1048 1048
 					$similarLangFallback = $option['@value'];
1049
-				} else if (strpos($attributeLang, $similarLang . '_') === 0) {
1049
+				} else if (strpos($attributeLang, $similarLang.'_') === 0) {
1050 1050
 					if ($similarLangFallback === false) {
1051
-						$similarLangFallback =  $option['@value'];
1051
+						$similarLangFallback = $option['@value'];
1052 1052
 					}
1053 1053
 				}
1054 1054
 			} else {
@@ -1083,7 +1083,7 @@  discard block
 block discarded – undo
1083 1083
 			$data['description'] = trim(self::findBestL10NOption($data['description'], $lang));
1084 1084
 		} else if (isset($data['description']) && is_string($data['description'])) {
1085 1085
 			$data['description'] = trim($data['description']);
1086
-		} else  {
1086
+		} else {
1087 1087
 			$data['description'] = '';
1088 1088
 		}
1089 1089
 
Please login to merge, or discard this patch.