diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-03-30 23:38:26 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-04-04 12:34:18 +0200 |
commit | 1bf4c75e8bfd32160ee7316c492ddc436f673f37 (patch) | |
tree | 123945f135aaebc0617318ef18b50fa7be125c13 /core/command | |
parent | 53c19027069707576f43fa9fc4c79324188a98de (diff) | |
download | nextcloud-server-1bf4c75e8bfd32160ee7316c492ddc436f673f37.tar.gz nextcloud-server-1bf4c75e8bfd32160ee7316c492ddc436f673f37.zip |
Show individual sql schema migration steps during upgrade - on web as well as on the command line
Diffstat (limited to 'core/command')
-rw-r--r-- | core/command/upgrade.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/core/command/upgrade.php b/core/command/upgrade.php index c45984d7a30..fbabf67a16a 100644 --- a/core/command/upgrade.php +++ b/core/command/upgrade.php @@ -34,9 +34,11 @@ use OC\Updater; use OCP\IConfig; use OCP\ILogger; use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Helper\ProgressBar; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\EventDispatcher\GenericEvent; class Upgrade extends Command { @@ -135,6 +137,24 @@ class Upgrade extends Command { $updater->setSimulateStepEnabled($simulateStepEnabled); $updater->setUpdateStepEnabled($updateStepEnabled); $updater->setSkip3rdPartyAppsDisable($skip3rdPartyAppsDisable); + $dispatcher = \OC::$server->getEventDispatcher(); + $progress = new ProgressBar($output); + $progress->setFormat("%message%\n %current%/%max% [%bar%] %percent:3s%%"); + $dispatcher->addListener('\OC\DB\Migrator::executeSql', function($event) use ($progress, $output) { + if ($event instanceof GenericEvent) { + if ($event[0] === 1) { + $output->writeln(''); + $progress->start($event[1]); + } + $progress->setMessage($event->getSubject()); + $progress->setProgress($event[0]); + $progress->display(); + if ($event[0] === $event[1]) { + $progress->finish(); + $output->writeln(''); + } + } + }); $updater->listen('\OC\Updater', 'maintenanceEnabled', function () use($output) { $output->writeln('<info>Turned on maintenance mode</info>'); |