diff options
author | Jörn Friedrich Dreyer <jfd@butonic.de> | 2016-10-20 17:06:10 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2016-10-24 17:52:49 +0200 |
commit | 817729dc3fc9a8233bfb4049f94c5f2136070ec9 (patch) | |
tree | 2dfea148dd5b50ae0413f8ac93f967fa5aebe1bf /lib/private/Console | |
parent | cfae91ab640676bb0c65a6293b74d9c252f9f089 (diff) | |
download | nextcloud-server-817729dc3fc9a8233bfb4049f94c5f2136070ec9.tar.gz nextcloud-server-817729dc3fc9a8233bfb4049f94c5f2136070ec9.zip |
add upgrade command before repair, handle NeedsUpgradeExcaption better
Diffstat (limited to 'lib/private/Console')
-rw-r--r-- | lib/private/Console/Application.php | 63 |
1 files changed, 34 insertions, 29 deletions
diff --git a/lib/private/Console/Application.php b/lib/private/Console/Application.php index 299b23714b6..cd76b43f095 100644 --- a/lib/private/Console/Application.php +++ b/lib/private/Console/Application.php @@ -26,6 +26,7 @@ */ namespace OC\Console; +use OC\NeedsUpdateException; use OC_App; use OCP\AppFramework\QueryException; use OCP\Console\ConsoleEvent; @@ -84,39 +85,43 @@ class Application { if ($input->getOption('no-warnings')) { $output->setVerbosity(OutputInterface::VERBOSITY_QUIET); } - require_once __DIR__ . '/../../../core/register_command.php'; - if ($this->config->getSystemValue('installed', false)) { - if (\OCP\Util::needUpgrade()) { - if ($input->getArgument('command') !== '_completion') { - $output->writeln("Nextcloud or one of the apps require upgrade - only a limited number of commands are available"); - $output->writeln("You may use your browser or the occ upgrade command to do the upgrade"); - } - } elseif ($this->config->getSystemValue('maintenance', false)) { - if ($input->getArgument('command') !== '_completion') { - $output->writeln("Nextcloud is in maintenance mode - no apps have been loaded"); - } - } else { - OC_App::loadApps(); - foreach (\OC::$server->getAppManager()->getInstalledApps() as $app) { - $appPath = \OC_App::getAppPath($app); - if($appPath === false) { - continue; - } - // load commands using info.xml - $info = \OC_App::getAppInfo($app); - if (isset($info['commands'])) { - $this->loadCommandsFromInfoXml($info['commands']); + try { + require_once __DIR__ . '/../../../core/register_command.php'; + if ($this->config->getSystemValue('installed', false)) { + if (\OCP\Util::needUpgrade()) { + throw new NeedsUpdateException(); + } elseif ($this->config->getSystemValue('maintenance', false)) { + if ($input->getArgument('command') !== '_completion') { + $output->writeln("Nextcloud is in maintenance mode - no apps have been loaded"); } - // load from register_command.php - \OC_App::registerAutoloading($app, $appPath); - $file = $appPath . '/appinfo/register_command.php'; - if (file_exists($file)) { - require $file; + } else { + OC_App::loadApps(); + foreach (\OC::$server->getAppManager()->getInstalledApps() as $app) { + $appPath = \OC_App::getAppPath($app); + if ($appPath === false) { + continue; + } + // load commands using info.xml + $info = \OC_App::getAppInfo($app); + if (isset($info['commands'])) { + $this->loadCommandsFromInfoXml($info['commands']); + } + // load from register_command.php + \OC_App::registerAutoloading($app, $appPath); + $file = $appPath . '/appinfo/register_command.php'; + if (file_exists($file)) { + require $file; + } } } + } else if ($input->getArgument('command') !== '_completion') { + $output->writeln("Nextcloud is not installed - only a limited number of commands are available"); + } + } catch(NeedsUpdateException $e) { + if ($input->getArgument('command') !== '_completion') { + $output->writeln("Nextcloud or one of the apps require upgrade - only a limited number of commands are available"); + $output->writeln("You may use your browser or the occ upgrade command to do the upgrade"); } - } else if ($input->getArgument('command') !== '_completion') { - $output->writeln("Nextcloud is not installed - only a limited number of commands are available"); } if ($input->getFirstArgument() !== 'check') { |