@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | * |
30 | 30 | */ |
31 | 31 | |
32 | -require_once __DIR__ . '/../lib/versioncheck.php'; |
|
33 | -require_once __DIR__ . '/../lib/base.php'; |
|
32 | +require_once __DIR__.'/../lib/versioncheck.php'; |
|
33 | +require_once __DIR__.'/../lib/base.php'; |
|
34 | 34 | |
35 | 35 | if (\OCP\Util::needUpgrade() |
36 | 36 | || \OC::$server->getConfig()->getSystemValueBool('maintenance')) { |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | * Try the appframework routes |
77 | 77 | */ |
78 | 78 | try { |
79 | - if(!\OC::$server->getUserSession()->isLoggedIn()) { |
|
79 | + if (!\OC::$server->getUserSession()->isLoggedIn()) { |
|
80 | 80 | OC::handleLogin(\OC::$server->getRequest()); |
81 | 81 | } |
82 | 82 | OC::$server->getRouter()->match('/ocsapp'.\OC::$server->getRequest()->getRawPathInfo()); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | OC_API::setContentType(); |
85 | 85 | |
86 | 86 | $format = \OC::$server->getRequest()->getParam('format', 'xml'); |
87 | - $txt='Invalid query, please check the syntax. API specifications are here:' |
|
87 | + $txt = 'Invalid query, please check the syntax. API specifications are here:' |
|
88 | 88 | .' http://www.freedesktop.org/wiki/Specifications/open-collaboration-services.'."\n"; |
89 | 89 | OC_API::respond(new \OC\OCS\Result(null, \OCP\API::RESPOND_NOT_FOUND, $txt), $format); |
90 | 90 | } catch (MethodNotAllowedException $e) { |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | OC_API::setContentType(); |
100 | 100 | |
101 | 101 | $format = \OC::$server->getRequest()->getParam('format', 'xml'); |
102 | - $txt='Invalid query, please check the syntax. API specifications are here:' |
|
102 | + $txt = 'Invalid query, please check the syntax. API specifications are here:' |
|
103 | 103 | .' http://www.freedesktop.org/wiki/Specifications/open-collaboration-services.'."\n"; |
104 | 104 | OC_API::respond(new \OC\OCS\Result(null, \OCP\API::RESPOND_NOT_FOUND, $txt), $format); |
105 | 105 | } |
@@ -101,12 +101,12 @@ discard block |
||
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 | } |
@@ -114,31 +114,31 @@ discard block |
||
114 | 114 | $installedVersion = $this->config->getSystemValue('version', '0.0.0'); |
115 | 115 | $currentVersion = implode('.', \OCP\Util::getVersion()); |
116 | 116 | |
117 | - $this->log->debug('starting upgrade from ' . $installedVersion . ' to ' . $currentVersion, array('app' => 'core')); |
|
117 | + $this->log->debug('starting upgrade from '.$installedVersion.' to '.$currentVersion, array('app' => 'core')); |
|
118 | 118 | |
119 | 119 | $success = true; |
120 | 120 | try { |
121 | 121 | $this->doUpgrade($currentVersion, $installedVersion); |
122 | 122 | } catch (HintException $exception) { |
123 | 123 | $this->log->logException($exception, ['app' => 'core']); |
124 | - $this->emit('\OC\Updater', 'failure', array($exception->getMessage() . ': ' .$exception->getHint())); |
|
124 | + $this->emit('\OC\Updater', 'failure', array($exception->getMessage().': '.$exception->getHint())); |
|
125 | 125 | $success = false; |
126 | 126 | } catch (\Exception $exception) { |
127 | 127 | $this->log->logException($exception, ['app' => 'core']); |
128 | - $this->emit('\OC\Updater', 'failure', array(get_class($exception) . ': ' .$exception->getMessage())); |
|
128 | + $this->emit('\OC\Updater', 'failure', array(get_class($exception).': '.$exception->getMessage())); |
|
129 | 129 | $success = false; |
130 | 130 | } |
131 | 131 | |
132 | 132 | $this->emit('\OC\Updater', 'updateEnd', array($success)); |
133 | 133 | |
134 | - if(!$wasMaintenanceModeEnabled && $success) { |
|
134 | + if (!$wasMaintenanceModeEnabled && $success) { |
|
135 | 135 | $this->config->setSystemValue('maintenance', false); |
136 | 136 | $this->emit('\OC\Updater', 'maintenanceDisabled'); |
137 | 137 | } else { |
138 | 138 | $this->emit('\OC\Updater', 'maintenanceActive'); |
139 | 139 | } |
140 | 140 | |
141 | - $this->emit('\OC\Updater', 'resetLogLevel', [ $logLevel, $this->logLevelNames[$logLevel] ]); |
|
141 | + $this->emit('\OC\Updater', 'resetLogLevel', [$logLevel, $this->logLevelNames[$logLevel]]); |
|
142 | 142 | $this->config->setSystemValue('loglevel', $logLevel); |
143 | 143 | $this->config->setSystemValue('installed', true); |
144 | 144 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | */ |
153 | 153 | private function getAllowedPreviousVersions() { |
154 | 154 | // this should really be a JSON file |
155 | - require \OC::$SERVERROOT . '/version.php'; |
|
155 | + require \OC::$SERVERROOT.'/version.php'; |
|
156 | 156 | /** @var array $OC_VersionCanBeUpgradedFrom */ |
157 | 157 | return $OC_VersionCanBeUpgradedFrom; |
158 | 158 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | */ |
165 | 165 | private function getVendor() { |
166 | 166 | // this should really be a JSON file |
167 | - require \OC::$SERVERROOT . '/version.php'; |
|
167 | + require \OC::$SERVERROOT.'/version.php'; |
|
168 | 168 | /** @var string $vendor */ |
169 | 169 | return (string) $vendor; |
170 | 170 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function isUpgradePossible($oldVersion, $newVersion, array $allowedPreviousVersions) { |
180 | 180 | $version = explode('.', $oldVersion); |
181 | - $majorMinor = $version[0] . '.' . $version[1]; |
|
181 | + $majorMinor = $version[0].'.'.$version[1]; |
|
182 | 182 | |
183 | 183 | $currentVendor = $this->config->getAppValue('core', 'vendor', ''); |
184 | 184 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | // create empty file in data dir, so we can later find |
226 | 226 | // out that this is indeed an ownCloud data directory |
227 | 227 | // (in case it didn't exist before) |
228 | - file_put_contents($this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/.ocdata', ''); |
|
228 | + file_put_contents($this->config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').'/.ocdata', ''); |
|
229 | 229 | |
230 | 230 | // pre-upgrade repairs |
231 | 231 | $repair = new Repair(Repair::getBeforeUpgradeRepairSteps(), \OC::$server->getEventDispatcher()); |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | foreach ($errors as $appId => $exception) { |
258 | 258 | /** @var \Exception $exception */ |
259 | 259 | $this->log->logException($exception, ['app' => $appId]); |
260 | - $this->emit('\OC\Updater', 'failure', [$appId . ': ' . $exception->getMessage()]); |
|
260 | + $this->emit('\OC\Updater', 'failure', [$appId.': '.$exception->getMessage()]); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | // post-upgrade repairs |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | $this->config->setAppValue('core', 'lastupdatedat', 0); |
269 | 269 | |
270 | 270 | // Check for code integrity if not disabled |
271 | - if(\OC::$server->getIntegrityCodeChecker()->isCodeCheckEnforced()) { |
|
271 | + if (\OC::$server->getIntegrityCodeChecker()->isCodeCheckEnforced()) { |
|
272 | 272 | $this->emit('\OC\Updater', 'startCheckCodeIntegrity'); |
273 | 273 | $this->checker->runInstanceVerification(); |
274 | 274 | $this->emit('\OC\Updater', 'finishedCheckCodeIntegrity'); |
@@ -309,12 +309,12 @@ discard block |
||
309 | 309 | * @link https://github.com/owncloud/core/issues/10980 |
310 | 310 | * @see \OC_App::updateApp |
311 | 311 | */ |
312 | - if (file_exists(\OC_App::getAppPath($appId) . '/appinfo/preupdate.php')) { |
|
312 | + if (file_exists(\OC_App::getAppPath($appId).'/appinfo/preupdate.php')) { |
|
313 | 313 | $this->includePreUpdate($appId); |
314 | 314 | } |
315 | - if (file_exists(\OC_App::getAppPath($appId) . '/appinfo/database.xml')) { |
|
315 | + if (file_exists(\OC_App::getAppPath($appId).'/appinfo/database.xml')) { |
|
316 | 316 | $this->emit('\OC\Updater', 'appSimulateUpdate', array($appId)); |
317 | - \OC_DB::simulateUpdateDbFromStructure(\OC_App::getAppPath($appId) . '/appinfo/database.xml'); |
|
317 | + \OC_DB::simulateUpdateDbFromStructure(\OC_App::getAppPath($appId).'/appinfo/database.xml'); |
|
318 | 318 | } |
319 | 319 | } |
320 | 320 | } |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | * @param string $appId |
328 | 328 | */ |
329 | 329 | private function includePreUpdate($appId) { |
330 | - include \OC_App::getAppPath($appId) . '/appinfo/preupdate.php'; |
|
330 | + include \OC_App::getAppPath($appId).'/appinfo/preupdate.php'; |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | /** |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | foreach ($apps as $appId) { |
346 | 346 | $priorityType = false; |
347 | 347 | foreach ($priorityTypes as $type) { |
348 | - if(!isset($stacks[$type])) { |
|
348 | + if (!isset($stacks[$type])) { |
|
349 | 349 | $stacks[$type] = array(); |
350 | 350 | } |
351 | 351 | if (\OC_App::isType($appId, [$type])) { |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | \OC_App::updateApp($appId); |
366 | 366 | $this->emit('\OC\Updater', 'appUpgrade', [$appId, \OC_App::getAppVersion($appId)]); |
367 | 367 | } |
368 | - if($type !== $pseudoOtherType) { |
|
368 | + if ($type !== $pseudoOtherType) { |
|
369 | 369 | // load authentication, filesystem and logging apps after |
370 | 370 | // upgrading them. Other apps my need to rely on modifying |
371 | 371 | // user and/or filesystem aspects. |
@@ -393,9 +393,9 @@ discard block |
||
393 | 393 | foreach ($apps as $app) { |
394 | 394 | // check if the app is compatible with this version of ownCloud |
395 | 395 | $info = OC_App::getAppInfo($app); |
396 | - if($info === null || !OC_App::isAppCompatible($version, $info)) { |
|
396 | + if ($info === null || !OC_App::isAppCompatible($version, $info)) { |
|
397 | 397 | if ($appManager->isShipped($app)) { |
398 | - throw new \UnexpectedValueException('The files of the app "' . $app . '" were not correctly replaced before running the update'); |
|
398 | + throw new \UnexpectedValueException('The files of the app "'.$app.'" were not correctly replaced before running the update'); |
|
399 | 399 | } |
400 | 400 | \OC::$server->getAppManager()->disableApp($app); |
401 | 401 | $this->emit('\OC\Updater', 'incompatibleAppDisabled', array($app)); |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | * @throws \Exception |
435 | 435 | */ |
436 | 436 | private function upgradeAppStoreApps(array $disabledApps, $reenable = false) { |
437 | - foreach($disabledApps as $app) { |
|
437 | + foreach ($disabledApps as $app) { |
|
438 | 438 | try { |
439 | 439 | $this->emit('\OC\Updater', 'checkAppStoreAppBefore', [$app]); |
440 | 440 | if ($this->installer->isUpdateAvailable($app)) { |
@@ -458,22 +458,22 @@ discard block |
||
458 | 458 | */ |
459 | 459 | private function emitRepairEvents() { |
460 | 460 | $dispatcher = \OC::$server->getEventDispatcher(); |
461 | - $dispatcher->addListener('\OC\Repair::warning', function ($event) { |
|
461 | + $dispatcher->addListener('\OC\Repair::warning', function($event) { |
|
462 | 462 | if ($event instanceof GenericEvent) { |
463 | 463 | $this->emit('\OC\Updater', 'repairWarning', $event->getArguments()); |
464 | 464 | } |
465 | 465 | }); |
466 | - $dispatcher->addListener('\OC\Repair::error', function ($event) { |
|
466 | + $dispatcher->addListener('\OC\Repair::error', function($event) { |
|
467 | 467 | if ($event instanceof GenericEvent) { |
468 | 468 | $this->emit('\OC\Updater', 'repairError', $event->getArguments()); |
469 | 469 | } |
470 | 470 | }); |
471 | - $dispatcher->addListener('\OC\Repair::info', function ($event) { |
|
471 | + $dispatcher->addListener('\OC\Repair::info', function($event) { |
|
472 | 472 | if ($event instanceof GenericEvent) { |
473 | 473 | $this->emit('\OC\Updater', 'repairInfo', $event->getArguments()); |
474 | 474 | } |
475 | 475 | }); |
476 | - $dispatcher->addListener('\OC\Repair::step', function ($event) { |
|
476 | + $dispatcher->addListener('\OC\Repair::step', function($event) { |
|
477 | 477 | if ($event instanceof GenericEvent) { |
478 | 478 | $this->emit('\OC\Updater', 'repairStep', $event->getArguments()); |
479 | 479 | } |
@@ -488,13 +488,13 @@ discard block |
||
488 | 488 | if (!$event instanceof GenericEvent) { |
489 | 489 | return; |
490 | 490 | } |
491 | - $log->info('\OC\DB\Migrator::executeSql: ' . $event->getSubject() . ' (' . $event->getArgument(0) . ' of ' . $event->getArgument(1) . ')', ['app' => 'updater']); |
|
491 | + $log->info('\OC\DB\Migrator::executeSql: '.$event->getSubject().' ('.$event->getArgument(0).' of '.$event->getArgument(1).')', ['app' => 'updater']); |
|
492 | 492 | }); |
493 | 493 | $dispatcher->addListener('\OC\DB\Migrator::checkTable', function($event) use ($log) { |
494 | 494 | if (!$event instanceof GenericEvent) { |
495 | 495 | return; |
496 | 496 | } |
497 | - $log->info('\OC\DB\Migrator::checkTable: ' . $event->getSubject() . ' (' . $event->getArgument(0) . ' of ' . $event->getArgument(1) . ')', ['app' => 'updater']); |
|
497 | + $log->info('\OC\DB\Migrator::checkTable: '.$event->getSubject().' ('.$event->getArgument(0).' of '.$event->getArgument(1).')', ['app' => 'updater']); |
|
498 | 498 | }); |
499 | 499 | |
500 | 500 | $repairListener = function($event) use ($log) { |
@@ -503,30 +503,30 @@ discard block |
||
503 | 503 | } |
504 | 504 | switch ($event->getSubject()) { |
505 | 505 | case '\OC\Repair::startProgress': |
506 | - $log->info('\OC\Repair::startProgress: Starting ... ' . $event->getArgument(1) . ' (' . $event->getArgument(0) . ')', ['app' => 'updater']); |
|
506 | + $log->info('\OC\Repair::startProgress: Starting ... '.$event->getArgument(1).' ('.$event->getArgument(0).')', ['app' => 'updater']); |
|
507 | 507 | break; |
508 | 508 | case '\OC\Repair::advance': |
509 | 509 | $desc = $event->getArgument(1); |
510 | 510 | if (empty($desc)) { |
511 | 511 | $desc = ''; |
512 | 512 | } |
513 | - $log->info('\OC\Repair::advance: ' . $desc . ' (' . $event->getArgument(0) . ')', ['app' => 'updater']); |
|
513 | + $log->info('\OC\Repair::advance: '.$desc.' ('.$event->getArgument(0).')', ['app' => 'updater']); |
|
514 | 514 | |
515 | 515 | break; |
516 | 516 | case '\OC\Repair::finishProgress': |
517 | 517 | $log->info('\OC\Repair::finishProgress', ['app' => 'updater']); |
518 | 518 | break; |
519 | 519 | case '\OC\Repair::step': |
520 | - $log->info('\OC\Repair::step: Repair step: ' . $event->getArgument(0), ['app' => 'updater']); |
|
520 | + $log->info('\OC\Repair::step: Repair step: '.$event->getArgument(0), ['app' => 'updater']); |
|
521 | 521 | break; |
522 | 522 | case '\OC\Repair::info': |
523 | - $log->info('\OC\Repair::info: Repair info: ' . $event->getArgument(0), ['app' => 'updater']); |
|
523 | + $log->info('\OC\Repair::info: Repair info: '.$event->getArgument(0), ['app' => 'updater']); |
|
524 | 524 | break; |
525 | 525 | case '\OC\Repair::warning': |
526 | - $log->warning('\OC\Repair::warning: Repair warning: ' . $event->getArgument(0), ['app' => 'updater']); |
|
526 | + $log->warning('\OC\Repair::warning: Repair warning: '.$event->getArgument(0), ['app' => 'updater']); |
|
527 | 527 | break; |
528 | 528 | case '\OC\Repair::error': |
529 | - $log->error('\OC\Repair::error: Repair error: ' . $event->getArgument(0), ['app' => 'updater']); |
|
529 | + $log->error('\OC\Repair::error: Repair error: '.$event->getArgument(0), ['app' => 'updater']); |
|
530 | 530 | break; |
531 | 531 | } |
532 | 532 | }; |
@@ -540,74 +540,74 @@ discard block |
||
540 | 540 | $dispatcher->addListener('\OC\Repair::error', $repairListener); |
541 | 541 | |
542 | 542 | |
543 | - $this->listen('\OC\Updater', 'maintenanceEnabled', function () use($log) { |
|
543 | + $this->listen('\OC\Updater', 'maintenanceEnabled', function() use($log) { |
|
544 | 544 | $log->info('\OC\Updater::maintenanceEnabled: Turned on maintenance mode', ['app' => 'updater']); |
545 | 545 | }); |
546 | - $this->listen('\OC\Updater', 'maintenanceDisabled', function () use($log) { |
|
546 | + $this->listen('\OC\Updater', 'maintenanceDisabled', function() use($log) { |
|
547 | 547 | $log->info('\OC\Updater::maintenanceDisabled: Turned off maintenance mode', ['app' => 'updater']); |
548 | 548 | }); |
549 | - $this->listen('\OC\Updater', 'maintenanceActive', function () use($log) { |
|
549 | + $this->listen('\OC\Updater', 'maintenanceActive', function() use($log) { |
|
550 | 550 | $log->info('\OC\Updater::maintenanceActive: Maintenance mode is kept active', ['app' => 'updater']); |
551 | 551 | }); |
552 | - $this->listen('\OC\Updater', 'updateEnd', function ($success) use($log) { |
|
552 | + $this->listen('\OC\Updater', 'updateEnd', function($success) use($log) { |
|
553 | 553 | if ($success) { |
554 | 554 | $log->info('\OC\Updater::updateEnd: Update successful', ['app' => 'updater']); |
555 | 555 | } else { |
556 | 556 | $log->error('\OC\Updater::updateEnd: Update failed', ['app' => 'updater']); |
557 | 557 | } |
558 | 558 | }); |
559 | - $this->listen('\OC\Updater', 'dbUpgradeBefore', function () use($log) { |
|
559 | + $this->listen('\OC\Updater', 'dbUpgradeBefore', function() use($log) { |
|
560 | 560 | $log->info('\OC\Updater::dbUpgradeBefore: Updating database schema', ['app' => 'updater']); |
561 | 561 | }); |
562 | - $this->listen('\OC\Updater', 'dbUpgrade', function () use($log) { |
|
562 | + $this->listen('\OC\Updater', 'dbUpgrade', function() use($log) { |
|
563 | 563 | $log->info('\OC\Updater::dbUpgrade: Updated database', ['app' => 'updater']); |
564 | 564 | }); |
565 | - $this->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function () use($log) { |
|
565 | + $this->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function() use($log) { |
|
566 | 566 | $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']); |
567 | 567 | }); |
568 | - $this->listen('\OC\Updater', 'dbSimulateUpgrade', function () use($log) { |
|
568 | + $this->listen('\OC\Updater', 'dbSimulateUpgrade', function() use($log) { |
|
569 | 569 | $log->info('\OC\Updater::dbSimulateUpgrade: Checked database schema update', ['app' => 'updater']); |
570 | 570 | }); |
571 | - $this->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use($log) { |
|
572 | - $log->info('\OC\Updater::incompatibleAppDisabled: Disabled incompatible app: ' . $app, ['app' => 'updater']); |
|
571 | + $this->listen('\OC\Updater', 'incompatibleAppDisabled', function($app) use($log) { |
|
572 | + $log->info('\OC\Updater::incompatibleAppDisabled: Disabled incompatible app: '.$app, ['app' => 'updater']); |
|
573 | 573 | }); |
574 | - $this->listen('\OC\Updater', 'checkAppStoreAppBefore', function ($app) use($log) { |
|
575 | - $log->info('\OC\Updater::checkAppStoreAppBefore: Checking for update of app "' . $app . '" in appstore', ['app' => 'updater']); |
|
574 | + $this->listen('\OC\Updater', 'checkAppStoreAppBefore', function($app) use($log) { |
|
575 | + $log->info('\OC\Updater::checkAppStoreAppBefore: Checking for update of app "'.$app.'" in appstore', ['app' => 'updater']); |
|
576 | 576 | }); |
577 | - $this->listen('\OC\Updater', 'upgradeAppStoreApp', function ($app) use($log) { |
|
578 | - $log->info('\OC\Updater::upgradeAppStoreApp: Update app "' . $app . '" from appstore', ['app' => 'updater']); |
|
577 | + $this->listen('\OC\Updater', 'upgradeAppStoreApp', function($app) use($log) { |
|
578 | + $log->info('\OC\Updater::upgradeAppStoreApp: Update app "'.$app.'" from appstore', ['app' => 'updater']); |
|
579 | 579 | }); |
580 | - $this->listen('\OC\Updater', 'checkAppStoreApp', function ($app) use($log) { |
|
581 | - $log->info('\OC\Updater::checkAppStoreApp: Checked for update of app "' . $app . '" in appstore', ['app' => 'updater']); |
|
580 | + $this->listen('\OC\Updater', 'checkAppStoreApp', function($app) use($log) { |
|
581 | + $log->info('\OC\Updater::checkAppStoreApp: Checked for update of app "'.$app.'" in appstore', ['app' => 'updater']); |
|
582 | 582 | }); |
583 | - $this->listen('\OC\Updater', 'appUpgradeCheckBefore', function () use ($log) { |
|
583 | + $this->listen('\OC\Updater', 'appUpgradeCheckBefore', function() use ($log) { |
|
584 | 584 | $log->info('\OC\Updater::appUpgradeCheckBefore: Checking updates of apps', ['app' => 'updater']); |
585 | 585 | }); |
586 | - $this->listen('\OC\Updater', 'appSimulateUpdate', function ($app) use ($log) { |
|
587 | - $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']); |
|
586 | + $this->listen('\OC\Updater', 'appSimulateUpdate', function($app) use ($log) { |
|
587 | + $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']); |
|
588 | 588 | }); |
589 | - $this->listen('\OC\Updater', 'appUpgradeCheck', function () use ($log) { |
|
589 | + $this->listen('\OC\Updater', 'appUpgradeCheck', function() use ($log) { |
|
590 | 590 | $log->info('\OC\Updater::appUpgradeCheck: Checked database schema update for apps', ['app' => 'updater']); |
591 | 591 | }); |
592 | - $this->listen('\OC\Updater', 'appUpgradeStarted', function ($app) use ($log) { |
|
593 | - $log->info('\OC\Updater::appUpgradeStarted: Updating <' . $app . '> ...', ['app' => 'updater']); |
|
592 | + $this->listen('\OC\Updater', 'appUpgradeStarted', function($app) use ($log) { |
|
593 | + $log->info('\OC\Updater::appUpgradeStarted: Updating <'.$app.'> ...', ['app' => 'updater']); |
|
594 | 594 | }); |
595 | - $this->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($log) { |
|
596 | - $log->info('\OC\Updater::appUpgrade: Updated <' . $app . '> to ' . $version, ['app' => 'updater']); |
|
595 | + $this->listen('\OC\Updater', 'appUpgrade', function($app, $version) use ($log) { |
|
596 | + $log->info('\OC\Updater::appUpgrade: Updated <'.$app.'> to '.$version, ['app' => 'updater']); |
|
597 | 597 | }); |
598 | - $this->listen('\OC\Updater', 'failure', function ($message) use($log) { |
|
599 | - $log->error('\OC\Updater::failure: ' . $message, ['app' => 'updater']); |
|
598 | + $this->listen('\OC\Updater', 'failure', function($message) use($log) { |
|
599 | + $log->error('\OC\Updater::failure: '.$message, ['app' => 'updater']); |
|
600 | 600 | }); |
601 | - $this->listen('\OC\Updater', 'setDebugLogLevel', function () use($log) { |
|
601 | + $this->listen('\OC\Updater', 'setDebugLogLevel', function() use($log) { |
|
602 | 602 | $log->info('\OC\Updater::setDebugLogLevel: Set log level to debug', ['app' => 'updater']); |
603 | 603 | }); |
604 | - $this->listen('\OC\Updater', 'resetLogLevel', function ($logLevel, $logLevelName) use($log) { |
|
605 | - $log->info('\OC\Updater::resetLogLevel: Reset log level to ' . $logLevelName . '(' . $logLevel . ')', ['app' => 'updater']); |
|
604 | + $this->listen('\OC\Updater', 'resetLogLevel', function($logLevel, $logLevelName) use($log) { |
|
605 | + $log->info('\OC\Updater::resetLogLevel: Reset log level to '.$logLevelName.'('.$logLevel.')', ['app' => 'updater']); |
|
606 | 606 | }); |
607 | - $this->listen('\OC\Updater', 'startCheckCodeIntegrity', function () use($log) { |
|
607 | + $this->listen('\OC\Updater', 'startCheckCodeIntegrity', function() use($log) { |
|
608 | 608 | $log->info('\OC\Updater::startCheckCodeIntegrity: Starting code integrity check...', ['app' => 'updater']); |
609 | 609 | }); |
610 | - $this->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function () use($log) { |
|
610 | + $this->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function() use($log) { |
|
611 | 611 | $log->info('\OC\Updater::finishedCheckCodeIntegrity: Finished code integrity check', ['app' => 'updater']); |
612 | 612 | }); |
613 | 613 |
@@ -128,14 +128,14 @@ discard block |
||
128 | 128 | * the app path list is empty or contains an invalid path |
129 | 129 | */ |
130 | 130 | public static function initPaths() { |
131 | - if(defined('PHPUNIT_CONFIG_DIR')) { |
|
132 | - self::$configDir = OC::$SERVERROOT . '/' . PHPUNIT_CONFIG_DIR . '/'; |
|
133 | - } elseif(defined('PHPUNIT_RUN') and PHPUNIT_RUN and is_dir(OC::$SERVERROOT . '/tests/config/')) { |
|
134 | - self::$configDir = OC::$SERVERROOT . '/tests/config/'; |
|
135 | - } elseif($dir = getenv('NEXTCLOUD_CONFIG_DIR')) { |
|
136 | - self::$configDir = rtrim($dir, '/') . '/'; |
|
131 | + if (defined('PHPUNIT_CONFIG_DIR')) { |
|
132 | + self::$configDir = OC::$SERVERROOT.'/'.PHPUNIT_CONFIG_DIR.'/'; |
|
133 | + } elseif (defined('PHPUNIT_RUN') and PHPUNIT_RUN and is_dir(OC::$SERVERROOT.'/tests/config/')) { |
|
134 | + self::$configDir = OC::$SERVERROOT.'/tests/config/'; |
|
135 | + } elseif ($dir = getenv('NEXTCLOUD_CONFIG_DIR')) { |
|
136 | + self::$configDir = rtrim($dir, '/').'/'; |
|
137 | 137 | } else { |
138 | - self::$configDir = OC::$SERVERROOT . '/config/'; |
|
138 | + self::$configDir = OC::$SERVERROOT.'/config/'; |
|
139 | 139 | } |
140 | 140 | self::$config = new \OC\Config(self::$configDir); |
141 | 141 | |
@@ -157,9 +157,9 @@ discard block |
||
157 | 157 | //make sure suburi follows the same rules as scriptName |
158 | 158 | if (substr(OC::$SUBURI, -9) != 'index.php') { |
159 | 159 | if (substr(OC::$SUBURI, -1) != '/') { |
160 | - OC::$SUBURI = OC::$SUBURI . '/'; |
|
160 | + OC::$SUBURI = OC::$SUBURI.'/'; |
|
161 | 161 | } |
162 | - OC::$SUBURI = OC::$SUBURI . 'index.php'; |
|
162 | + OC::$SUBURI = OC::$SUBURI.'index.php'; |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | OC::$WEBROOT = substr($scriptName, 0, 0 - strlen(OC::$SUBURI)); |
172 | 172 | |
173 | 173 | if (OC::$WEBROOT != '' && OC::$WEBROOT[0] !== '/') { |
174 | - OC::$WEBROOT = '/' . OC::$WEBROOT; |
|
174 | + OC::$WEBROOT = '/'.OC::$WEBROOT; |
|
175 | 175 | } |
176 | 176 | } else { |
177 | 177 | // The scriptName is not ending with OC::$SUBURI |
@@ -200,11 +200,11 @@ discard block |
||
200 | 200 | OC::$APPSROOTS[] = $paths; |
201 | 201 | } |
202 | 202 | } |
203 | - } elseif (file_exists(OC::$SERVERROOT . '/apps')) { |
|
204 | - OC::$APPSROOTS[] = array('path' => OC::$SERVERROOT . '/apps', 'url' => '/apps', 'writable' => true); |
|
205 | - } elseif (file_exists(OC::$SERVERROOT . '/../apps')) { |
|
203 | + } elseif (file_exists(OC::$SERVERROOT.'/apps')) { |
|
204 | + OC::$APPSROOTS[] = array('path' => OC::$SERVERROOT.'/apps', 'url' => '/apps', 'writable' => true); |
|
205 | + } elseif (file_exists(OC::$SERVERROOT.'/../apps')) { |
|
206 | 206 | OC::$APPSROOTS[] = array( |
207 | - 'path' => rtrim(dirname(OC::$SERVERROOT), '/') . '/apps', |
|
207 | + 'path' => rtrim(dirname(OC::$SERVERROOT), '/').'/apps', |
|
208 | 208 | 'url' => '/apps', |
209 | 209 | 'writable' => true |
210 | 210 | ); |
@@ -234,8 +234,8 @@ discard block |
||
234 | 234 | $l = \OC::$server->getL10N('lib'); |
235 | 235 | |
236 | 236 | // Create config if it does not already exist |
237 | - $configFilePath = self::$configDir .'/config.php'; |
|
238 | - if(!file_exists($configFilePath)) { |
|
237 | + $configFilePath = self::$configDir.'/config.php'; |
|
238 | + if (!file_exists($configFilePath)) { |
|
239 | 239 | @touch($configFilePath); |
240 | 240 | } |
241 | 241 | |
@@ -249,18 +249,18 @@ discard block |
||
249 | 249 | if (self::$CLI) { |
250 | 250 | echo $l->t('Cannot write into "config" directory!')."\n"; |
251 | 251 | echo $l->t('This can usually be fixed by giving the webserver write access to the config directory')."\n"; |
252 | - echo $l->t('See %s', [ $urlGenerator->linkToDocs('admin-dir_permissions') ])."\n"; |
|
252 | + echo $l->t('See %s', [$urlGenerator->linkToDocs('admin-dir_permissions')])."\n"; |
|
253 | 253 | echo "\n"; |
254 | 254 | echo $l->t('Or, if you prefer to keep config.php file read only, set the option "config_is_read_only" to true in it.')."\n"; |
255 | - echo $l->t('See %s', [ $urlGenerator->linkToDocs('admin-config') ])."\n"; |
|
255 | + echo $l->t('See %s', [$urlGenerator->linkToDocs('admin-config')])."\n"; |
|
256 | 256 | exit; |
257 | 257 | } else { |
258 | 258 | OC_Template::printErrorPage( |
259 | 259 | $l->t('Cannot write into "config" directory!'), |
260 | 260 | $l->t('This can usually be fixed by giving the webserver write access to the config directory. See %s', |
261 | - [ $urlGenerator->linkToDocs('admin-dir_permissions') ]) . '. ' |
|
261 | + [$urlGenerator->linkToDocs('admin-dir_permissions')]).'. ' |
|
262 | 262 | . $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', |
263 | - [ $urlGenerator->linkToDocs('admin-config') ] ), |
|
263 | + [$urlGenerator->linkToDocs('admin-config')]), |
|
264 | 264 | 503 |
265 | 265 | ); |
266 | 266 | } |
@@ -276,8 +276,8 @@ discard block |
||
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 | } |
@@ -382,14 +382,14 @@ discard block |
||
382 | 382 | $incompatibleShippedApps = []; |
383 | 383 | foreach ($incompatibleApps as $appInfo) { |
384 | 384 | if ($appManager->isShipped($appInfo['id'])) { |
385 | - $incompatibleShippedApps[] = $appInfo['name'] . ' (' . $appInfo['id'] . ')'; |
|
385 | + $incompatibleShippedApps[] = $appInfo['name'].' ('.$appInfo['id'].')'; |
|
386 | 386 | } |
387 | 387 | } |
388 | 388 | |
389 | 389 | if (!empty($incompatibleShippedApps)) { |
390 | 390 | $l = \OC::$server->getL10N('core'); |
391 | 391 | $hint = $l->t('The files of the app %$1s were not replaced correctly. Make sure it is a version compatible with the server.', [implode(', ', $incompatibleShippedApps)]); |
392 | - throw new \OC\HintException('The files of the app ' . implode(', ', $incompatibleShippedApps) . ' were not replaced correctly. Make sure it is a version compatible with the server.', $hint); |
|
392 | + throw new \OC\HintException('The files of the app '.implode(', ', $incompatibleShippedApps).' were not replaced correctly. Make sure it is a version compatible with the server.', $hint); |
|
393 | 393 | } |
394 | 394 | |
395 | 395 | $tmpl->assign('appsToUpgrade', $appManager->getAppsNeedingUpgrade($ocVersion)); |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | } |
401 | 401 | |
402 | 402 | public static function initSession() { |
403 | - if(self::$server->getRequest()->getServerProtocol() === 'https') { |
|
403 | + if (self::$server->getRequest()->getServerProtocol() === 'https') { |
|
404 | 404 | ini_set('session.cookie_secure', true); |
405 | 405 | } |
406 | 406 | |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | ini_set('session.cookie_httponly', 'true'); |
409 | 409 | |
410 | 410 | // set the cookie path to the Nextcloud directory |
411 | - $cookie_path = OC::$WEBROOT ? : '/'; |
|
411 | + $cookie_path = OC::$WEBROOT ?: '/'; |
|
412 | 412 | ini_set('session.cookie_path', $cookie_path); |
413 | 413 | |
414 | 414 | // Let the session name be changed in the initSession Hook |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | // session timeout |
442 | 442 | if ($session->exists('LAST_ACTIVITY') && (time() - $session->get('LAST_ACTIVITY') > $sessionLifeTime)) { |
443 | 443 | if (isset($_COOKIE[session_name()])) { |
444 | - setcookie(session_name(), '', -1, self::$WEBROOT ? : '/'); |
|
444 | + setcookie(session_name(), '', -1, self::$WEBROOT ?: '/'); |
|
445 | 445 | } |
446 | 446 | \OC::$server->getUserSession()->logout(); |
447 | 447 | } |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | continue; |
464 | 464 | } |
465 | 465 | |
466 | - $file = $appPath . '/appinfo/classpath.php'; |
|
466 | + $file = $appPath.'/appinfo/classpath.php'; |
|
467 | 467 | if (file_exists($file)) { |
468 | 468 | require_once $file; |
469 | 469 | } |
@@ -491,14 +491,14 @@ discard block |
||
491 | 491 | |
492 | 492 | // Append __Host to the cookie if it meets the requirements |
493 | 493 | $cookiePrefix = ''; |
494 | - if($cookieParams['secure'] === true && $cookieParams['path'] === '/') { |
|
494 | + if ($cookieParams['secure'] === true && $cookieParams['path'] === '/') { |
|
495 | 495 | $cookiePrefix = '__Host-'; |
496 | 496 | } |
497 | 497 | |
498 | - foreach($policies as $policy) { |
|
498 | + foreach ($policies as $policy) { |
|
499 | 499 | header( |
500 | 500 | sprintf( |
501 | - 'Set-Cookie: %snc_sameSiteCookie%s=true; path=%s; httponly;' . $secureCookie . 'expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=%s', |
|
501 | + 'Set-Cookie: %snc_sameSiteCookie%s=true; path=%s; httponly;'.$secureCookie.'expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=%s', |
|
502 | 502 | $cookiePrefix, |
503 | 503 | $policy, |
504 | 504 | $cookieParams['path'], |
@@ -537,31 +537,31 @@ discard block |
||
537 | 537 | ]; |
538 | 538 | } |
539 | 539 | |
540 | - if($request->isUserAgent($incompatibleUserAgents)) { |
|
540 | + if ($request->isUserAgent($incompatibleUserAgents)) { |
|
541 | 541 | return; |
542 | 542 | } |
543 | 543 | |
544 | - if(count($_COOKIE) > 0) { |
|
544 | + if (count($_COOKIE) > 0) { |
|
545 | 545 | $requestUri = $request->getScriptName(); |
546 | 546 | $processingScript = explode('/', $requestUri); |
547 | - $processingScript = $processingScript[count($processingScript)-1]; |
|
547 | + $processingScript = $processingScript[count($processingScript) - 1]; |
|
548 | 548 | |
549 | 549 | // index.php routes are handled in the middleware |
550 | - if($processingScript === 'index.php') { |
|
550 | + if ($processingScript === 'index.php') { |
|
551 | 551 | return; |
552 | 552 | } |
553 | 553 | |
554 | 554 | // All other endpoints require the lax and the strict cookie |
555 | - if(!$request->passesStrictCookieCheck()) { |
|
555 | + if (!$request->passesStrictCookieCheck()) { |
|
556 | 556 | self::sendSameSiteCookies(); |
557 | 557 | // Debug mode gets access to the resources without strict cookie |
558 | 558 | // due to the fact that the SabreDAV browser also lives there. |
559 | - if(!\OC::$server->getConfig()->getSystemValue('debug', false)) { |
|
559 | + if (!\OC::$server->getConfig()->getSystemValue('debug', false)) { |
|
560 | 560 | http_response_code(\OCP\AppFramework\Http::STATUS_SERVICE_UNAVAILABLE); |
561 | 561 | exit(); |
562 | 562 | } |
563 | 563 | } |
564 | - } elseif(!isset($_COOKIE['nc_sameSiteCookielax']) || !isset($_COOKIE['nc_sameSiteCookiestrict'])) { |
|
564 | + } elseif (!isset($_COOKIE['nc_sameSiteCookielax']) || !isset($_COOKIE['nc_sameSiteCookiestrict'])) { |
|
565 | 565 | self::sendSameSiteCookies(); |
566 | 566 | } |
567 | 567 | } |
@@ -572,12 +572,12 @@ discard block |
||
572 | 572 | |
573 | 573 | // register autoloader |
574 | 574 | $loaderStart = microtime(true); |
575 | - require_once __DIR__ . '/autoloader.php'; |
|
575 | + require_once __DIR__.'/autoloader.php'; |
|
576 | 576 | self::$loader = new \OC\Autoloader([ |
577 | - OC::$SERVERROOT . '/lib/private/legacy', |
|
577 | + OC::$SERVERROOT.'/lib/private/legacy', |
|
578 | 578 | ]); |
579 | 579 | if (defined('PHPUNIT_RUN')) { |
580 | - self::$loader->addValidRoot(OC::$SERVERROOT . '/tests'); |
|
580 | + self::$loader->addValidRoot(OC::$SERVERROOT.'/tests'); |
|
581 | 581 | } |
582 | 582 | spl_autoload_register(array(self::$loader, 'load')); |
583 | 583 | $loaderEnd = microtime(true); |
@@ -585,12 +585,12 @@ discard block |
||
585 | 585 | self::$CLI = (php_sapi_name() == 'cli'); |
586 | 586 | |
587 | 587 | // Add default composer PSR-4 autoloader |
588 | - self::$composerAutoloader = require_once OC::$SERVERROOT . '/lib/composer/autoload.php'; |
|
588 | + self::$composerAutoloader = require_once OC::$SERVERROOT.'/lib/composer/autoload.php'; |
|
589 | 589 | |
590 | 590 | try { |
591 | 591 | self::initPaths(); |
592 | 592 | // setup 3rdparty autoloader |
593 | - $vendorAutoLoad = OC::$SERVERROOT. '/3rdparty/autoload.php'; |
|
593 | + $vendorAutoLoad = OC::$SERVERROOT.'/3rdparty/autoload.php'; |
|
594 | 594 | if (!file_exists($vendorAutoLoad)) { |
595 | 595 | 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".'); |
596 | 596 | } |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | @ini_set('display_errors', '0'); |
617 | 617 | @ini_set('log_errors', '1'); |
618 | 618 | |
619 | - if(!date_default_timezone_set('UTC')) { |
|
619 | + if (!date_default_timezone_set('UTC')) { |
|
620 | 620 | throw new \RuntimeException('Could not set timezone to UTC'); |
621 | 621 | } |
622 | 622 | |
@@ -670,11 +670,11 @@ discard block |
||
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 | |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | } |
697 | 697 | //try to set the session lifetime |
698 | 698 | $sessionLifeTime = self::getSessionLifeTime(); |
699 | - @ini_set('gc_maxlifetime', (string)$sessionLifeTime); |
|
699 | + @ini_set('gc_maxlifetime', (string) $sessionLifeTime); |
|
700 | 700 | |
701 | 701 | $systemConfig = \OC::$server->getSystemConfig(); |
702 | 702 | |
@@ -744,7 +744,7 @@ discard block |
||
744 | 744 | register_shutdown_function(array($lockProvider, 'releaseAll')); |
745 | 745 | |
746 | 746 | // Check whether the sample configuration has been copied |
747 | - if($systemConfig->getValue('copied_sample_config', false)) { |
|
747 | + if ($systemConfig->getValue('copied_sample_config', false)) { |
|
748 | 748 | $l = \OC::$server->getL10N('lib'); |
749 | 749 | OC_Template::printErrorPage( |
750 | 750 | $l->t('Sample configuration detected'), |
@@ -769,11 +769,11 @@ discard block |
||
769 | 769 | ) { |
770 | 770 | // Allow access to CSS resources |
771 | 771 | $isScssRequest = false; |
772 | - if(strpos($request->getPathInfo(), '/css/') === 0) { |
|
772 | + if (strpos($request->getPathInfo(), '/css/') === 0) { |
|
773 | 773 | $isScssRequest = true; |
774 | 774 | } |
775 | 775 | |
776 | - if(substr($request->getRequestUri(), -11) === '/status.php') { |
|
776 | + if (substr($request->getRequestUri(), -11) === '/status.php') { |
|
777 | 777 | http_response_code(400); |
778 | 778 | header('Content-Type: application/json'); |
779 | 779 | echo '{"error": "Trusted domain error.", "code": 15}'; |
@@ -811,7 +811,7 @@ discard block |
||
811 | 811 | |
812 | 812 | // NOTE: This will be replaced to use OCP |
813 | 813 | $userSession = self::$server->getUserSession(); |
814 | - $userSession->listen('\OC\User', 'postLogin', function () use ($userSession) { |
|
814 | + $userSession->listen('\OC\User', 'postLogin', function() use ($userSession) { |
|
815 | 815 | if (!defined('PHPUNIT_RUN')) { |
816 | 816 | // reset brute force delay for this IP address and username |
817 | 817 | $uid = \OC::$server->getUserSession()->getUser()->getUID(); |
@@ -948,12 +948,12 @@ discard block |
||
948 | 948 | // emergency app disabling |
949 | 949 | if ($requestPath === '/disableapp' |
950 | 950 | && $request->getMethod() === 'POST' |
951 | - && ((array)$request->getParam('appid')) !== '' |
|
951 | + && ((array) $request->getParam('appid')) !== '' |
|
952 | 952 | ) { |
953 | 953 | \OC_JSON::callCheck(); |
954 | 954 | \OC_JSON::checkAdminUser(); |
955 | - $appIds = (array)$request->getParam('appid'); |
|
956 | - foreach($appIds as $appId) { |
|
955 | + $appIds = (array) $request->getParam('appid'); |
|
956 | + foreach ($appIds as $appId) { |
|
957 | 957 | $appId = \OC_App::cleanAppId($appId); |
958 | 958 | \OC::$server->getAppManager()->disableApp($appId); |
959 | 959 | } |
@@ -968,7 +968,7 @@ discard block |
||
968 | 968 | if (!\OCP\Util::needUpgrade() |
969 | 969 | && !((bool) $systemConfig->getValue('maintenance', false))) { |
970 | 970 | // For logged-in users: Load everything |
971 | - if(\OC::$server->getUserSession()->isLoggedIn()) { |
|
971 | + if (\OC::$server->getUserSession()->isLoggedIn()) { |
|
972 | 972 | OC_App::loadApps(); |
973 | 973 | } else { |
974 | 974 | // For guests: Load only filesystem and logging |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | protected function execute(InputInterface $input, OutputInterface $output) { |
89 | 89 | |
90 | - if(Util::needUpgrade()) { |
|
90 | + if (Util::needUpgrade()) { |
|
91 | 91 | if (OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) { |
92 | 92 | // Prepend each line with a little timestamp |
93 | 93 | $timestampFormatter = new TimestampFormatter($this->config, $output->getFormatter()); |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | if ($event instanceof GenericEvent) { |
110 | 110 | $message = $event->getSubject(); |
111 | 111 | if (OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) { |
112 | - $output->writeln(' Checking table ' . $message); |
|
112 | + $output->writeln(' Checking table '.$message); |
|
113 | 113 | } else { |
114 | 114 | if (strlen($message) > 60) { |
115 | - $message = substr($message, 0, 57) . '...'; |
|
115 | + $message = substr($message, 0, 57).'...'; |
|
116 | 116 | } |
117 | 117 | $progress->setMessage($message); |
118 | 118 | if ($event[0] === 1) { |
@@ -153,20 +153,20 @@ discard block |
||
153 | 153 | $output->writeln(''); |
154 | 154 | break; |
155 | 155 | case '\OC\Repair::step': |
156 | - if(OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) { |
|
157 | - $output->writeln('<info>Repair step: ' . $event->getArgument(0) . '</info>'); |
|
156 | + if (OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) { |
|
157 | + $output->writeln('<info>Repair step: '.$event->getArgument(0).'</info>'); |
|
158 | 158 | } |
159 | 159 | break; |
160 | 160 | case '\OC\Repair::info': |
161 | - if(OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) { |
|
162 | - $output->writeln('<info>Repair info: ' . $event->getArgument(0) . '</info>'); |
|
161 | + if (OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) { |
|
162 | + $output->writeln('<info>Repair info: '.$event->getArgument(0).'</info>'); |
|
163 | 163 | } |
164 | 164 | break; |
165 | 165 | case '\OC\Repair::warning': |
166 | - $output->writeln('<error>Repair warning: ' . $event->getArgument(0) . '</error>'); |
|
166 | + $output->writeln('<error>Repair warning: '.$event->getArgument(0).'</error>'); |
|
167 | 167 | break; |
168 | 168 | case '\OC\Repair::error': |
169 | - $output->writeln('<error>Repair error: ' . $event->getArgument(0) . '</error>'); |
|
169 | + $output->writeln('<error>Repair error: '.$event->getArgument(0).'</error>'); |
|
170 | 170 | break; |
171 | 171 | } |
172 | 172 | }; |
@@ -182,17 +182,17 @@ discard block |
||
182 | 182 | $dispatcher->addListener('\OC\Repair::error', $repairListener); |
183 | 183 | |
184 | 184 | |
185 | - $updater->listen('\OC\Updater', 'maintenanceEnabled', function () use($output) { |
|
185 | + $updater->listen('\OC\Updater', 'maintenanceEnabled', function() use($output) { |
|
186 | 186 | $output->writeln('<info>Turned on maintenance mode</info>'); |
187 | 187 | }); |
188 | - $updater->listen('\OC\Updater', 'maintenanceDisabled', function () use($output) { |
|
188 | + $updater->listen('\OC\Updater', 'maintenanceDisabled', function() use($output) { |
|
189 | 189 | $output->writeln('<info>Turned off maintenance mode</info>'); |
190 | 190 | }); |
191 | - $updater->listen('\OC\Updater', 'maintenanceActive', function () use($output) { |
|
191 | + $updater->listen('\OC\Updater', 'maintenanceActive', function() use($output) { |
|
192 | 192 | $output->writeln('<info>Maintenance mode is kept active</info>'); |
193 | 193 | }); |
194 | 194 | $updater->listen('\OC\Updater', 'updateEnd', |
195 | - function ($success) use($output, $self) { |
|
195 | + function($success) use($output, $self) { |
|
196 | 196 | if ($success) { |
197 | 197 | $message = "<info>Update successful</info>"; |
198 | 198 | } else { |
@@ -200,58 +200,58 @@ discard block |
||
200 | 200 | } |
201 | 201 | $output->writeln($message); |
202 | 202 | }); |
203 | - $updater->listen('\OC\Updater', 'dbUpgradeBefore', function () use($output) { |
|
203 | + $updater->listen('\OC\Updater', 'dbUpgradeBefore', function() use($output) { |
|
204 | 204 | $output->writeln('<info>Updating database schema</info>'); |
205 | 205 | }); |
206 | - $updater->listen('\OC\Updater', 'dbUpgrade', function () use($output) { |
|
206 | + $updater->listen('\OC\Updater', 'dbUpgrade', function() use($output) { |
|
207 | 207 | $output->writeln('<info>Updated database</info>'); |
208 | 208 | }); |
209 | - $updater->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function () use($output) { |
|
209 | + $updater->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function() use($output) { |
|
210 | 210 | $output->writeln('<info>Checking whether the database schema can be updated (this can take a long time depending on the database size)</info>'); |
211 | 211 | }); |
212 | - $updater->listen('\OC\Updater', 'dbSimulateUpgrade', function () use($output) { |
|
212 | + $updater->listen('\OC\Updater', 'dbSimulateUpgrade', function() use($output) { |
|
213 | 213 | $output->writeln('<info>Checked database schema update</info>'); |
214 | 214 | }); |
215 | - $updater->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use($output) { |
|
216 | - $output->writeln('<comment>Disabled incompatible app: ' . $app . '</comment>'); |
|
215 | + $updater->listen('\OC\Updater', 'incompatibleAppDisabled', function($app) use($output) { |
|
216 | + $output->writeln('<comment>Disabled incompatible app: '.$app.'</comment>'); |
|
217 | 217 | }); |
218 | - $updater->listen('\OC\Updater', 'checkAppStoreAppBefore', function ($app) use($output) { |
|
219 | - $output->writeln('<info>Checking for update of app ' . $app . ' in appstore</info>'); |
|
218 | + $updater->listen('\OC\Updater', 'checkAppStoreAppBefore', function($app) use($output) { |
|
219 | + $output->writeln('<info>Checking for update of app '.$app.' in appstore</info>'); |
|
220 | 220 | }); |
221 | - $updater->listen('\OC\Updater', 'upgradeAppStoreApp', function ($app) use($output) { |
|
222 | - $output->writeln('<info>Update app ' . $app . ' from appstore</info>'); |
|
221 | + $updater->listen('\OC\Updater', 'upgradeAppStoreApp', function($app) use($output) { |
|
222 | + $output->writeln('<info>Update app '.$app.' from appstore</info>'); |
|
223 | 223 | }); |
224 | - $updater->listen('\OC\Updater', 'checkAppStoreApp', function ($app) use($output) { |
|
225 | - $output->writeln('<info>Checked for update of app "' . $app . '" in appstore </info>'); |
|
224 | + $updater->listen('\OC\Updater', 'checkAppStoreApp', function($app) use($output) { |
|
225 | + $output->writeln('<info>Checked for update of app "'.$app.'" in appstore </info>'); |
|
226 | 226 | }); |
227 | - $updater->listen('\OC\Updater', 'appUpgradeCheckBefore', function () use ($output) { |
|
227 | + $updater->listen('\OC\Updater', 'appUpgradeCheckBefore', function() use ($output) { |
|
228 | 228 | $output->writeln('<info>Checking updates of apps</info>'); |
229 | 229 | }); |
230 | - $updater->listen('\OC\Updater', 'appSimulateUpdate', function ($app) use ($output) { |
|
230 | + $updater->listen('\OC\Updater', 'appSimulateUpdate', function($app) use ($output) { |
|
231 | 231 | $output->writeln("<info>Checking whether the database schema for <$app> can be updated (this can take a long time depending on the database size)</info>"); |
232 | 232 | }); |
233 | - $updater->listen('\OC\Updater', 'appUpgradeCheck', function () use ($output) { |
|
233 | + $updater->listen('\OC\Updater', 'appUpgradeCheck', function() use ($output) { |
|
234 | 234 | $output->writeln('<info>Checked database schema update for apps</info>'); |
235 | 235 | }); |
236 | - $updater->listen('\OC\Updater', 'appUpgradeStarted', function ($app, $version) use ($output) { |
|
236 | + $updater->listen('\OC\Updater', 'appUpgradeStarted', function($app, $version) use ($output) { |
|
237 | 237 | $output->writeln("<info>Updating <$app> ...</info>"); |
238 | 238 | }); |
239 | - $updater->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($output) { |
|
239 | + $updater->listen('\OC\Updater', 'appUpgrade', function($app, $version) use ($output) { |
|
240 | 240 | $output->writeln("<info>Updated <$app> to $version</info>"); |
241 | 241 | }); |
242 | - $updater->listen('\OC\Updater', 'failure', function ($message) use($output, $self) { |
|
242 | + $updater->listen('\OC\Updater', 'failure', function($message) use($output, $self) { |
|
243 | 243 | $output->writeln("<error>$message</error>"); |
244 | 244 | }); |
245 | - $updater->listen('\OC\Updater', 'setDebugLogLevel', function ($logLevel, $logLevelName) use($output) { |
|
245 | + $updater->listen('\OC\Updater', 'setDebugLogLevel', function($logLevel, $logLevelName) use($output) { |
|
246 | 246 | $output->writeln("<info>Set log level to debug</info>"); |
247 | 247 | }); |
248 | - $updater->listen('\OC\Updater', 'resetLogLevel', function ($logLevel, $logLevelName) use($output) { |
|
248 | + $updater->listen('\OC\Updater', 'resetLogLevel', function($logLevel, $logLevelName) use($output) { |
|
249 | 249 | $output->writeln("<info>Reset log level</info>"); |
250 | 250 | }); |
251 | - $updater->listen('\OC\Updater', 'startCheckCodeIntegrity', function () use($output) { |
|
251 | + $updater->listen('\OC\Updater', 'startCheckCodeIntegrity', function() use($output) { |
|
252 | 252 | $output->writeln("<info>Starting code integrity check...</info>"); |
253 | 253 | }); |
254 | - $updater->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function () use($output) { |
|
254 | + $updater->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function() use($output) { |
|
255 | 255 | $output->writeln("<info>Finished code integrity check</info>"); |
256 | 256 | }); |
257 | 257 | |
@@ -259,12 +259,12 @@ discard block |
||
259 | 259 | |
260 | 260 | $this->postUpgradeCheck($input, $output); |
261 | 261 | |
262 | - if(!$success) { |
|
262 | + if (!$success) { |
|
263 | 263 | return self::ERROR_FAILURE; |
264 | 264 | } |
265 | 265 | |
266 | 266 | return self::ERROR_SUCCESS; |
267 | - } else if($this->config->getSystemValueBool('maintenance')) { |
|
267 | + } else if ($this->config->getSystemValueBool('maintenance')) { |
|
268 | 268 | //Possible scenario: Nextcloud core is updated but an app failed |
269 | 269 | $output->writeln('<warning>Nextcloud is in maintenance mode</warning>'); |
270 | 270 | $output->write('<comment>Maybe an upgrade is already in process. Please check the ' |
@@ -289,8 +289,8 @@ discard block |
||
289 | 289 | $trustedDomains = $this->config->getSystemValue('trusted_domains', array()); |
290 | 290 | if (empty($trustedDomains)) { |
291 | 291 | $output->write( |
292 | - '<warning>The setting "trusted_domains" could not be ' . |
|
293 | - 'set automatically by the upgrade script, ' . |
|
292 | + '<warning>The setting "trusted_domains" could not be '. |
|
293 | + 'set automatically by the upgrade script, '. |
|
294 | 294 | 'please set it manually</warning>' |
295 | 295 | ); |
296 | 296 | } |