Add some color to the occ upgrade output.

This commit is contained in:
Andreas Fischer 2013-10-28 22:26:44 +01:00
parent b8dbec0da4
commit 70111ea299

View file

@ -38,7 +38,7 @@ class Upgrade extends Command {
// Don't do anything if ownCloud has not been installed // Don't do anything if ownCloud has not been installed
if(!\OC_Config::getValue('installed', false)) { if(!\OC_Config::getValue('installed', false)) {
$output->writeln('ownCloud has not yet been installed'); $output->writeln('<error>ownCloud has not yet been installed</error>');
return self::ERROR_NOT_INSTALLED; return self::ERROR_NOT_INSTALLED;
} }
@ -46,20 +46,20 @@ class Upgrade extends Command {
$updater = new Updater(); $updater = new Updater();
$updater->listen('\OC\Updater', 'maintenanceStart', function () use($output) { $updater->listen('\OC\Updater', 'maintenanceStart', function () use($output) {
$output->writeln('Turned on maintenance mode'); $output->writeln('<info>Turned on maintenance mode</info>');
}); });
$updater->listen('\OC\Updater', 'maintenanceEnd', function () use($output) { $updater->listen('\OC\Updater', 'maintenanceEnd', function () use($output) {
$output->writeln('Turned off maintenance mode'); $output->writeln('<info>Turned off maintenance mode</info>');
$output->writeln('Update successful'); $output->writeln('<info>Update successful</info>');
}); });
$updater->listen('\OC\Updater', 'dbUpgrade', function () use($output) { $updater->listen('\OC\Updater', 'dbUpgrade', function () use($output) {
$output->writeln('Updated database'); $output->writeln('<info>Updated database</info>');
}); });
$updater->listen('\OC\Updater', 'filecacheStart', function () use($output) { $updater->listen('\OC\Updater', 'filecacheStart', function () use($output) {
$output->writeln('Updating filecache, this may take really long...'); $output->writeln('<info>Updating filecache, this may take really long...</info>');
}); });
$updater->listen('\OC\Updater', 'filecacheDone', function () use($output) { $updater->listen('\OC\Updater', 'filecacheDone', function () use($output) {
$output->writeln('Updated filecache'); $output->writeln('<info>Updated filecache</info>');
}); });
$updater->listen('\OC\Updater', 'filecacheProgress', function ($out) use($output) { $updater->listen('\OC\Updater', 'filecacheProgress', function ($out) use($output) {
$output->writeln('... ' . $out . '% done ...'); $output->writeln('... ' . $out . '% done ...');
@ -74,15 +74,15 @@ class Upgrade extends Command {
return self::ERROR_SUCCESS; return self::ERROR_SUCCESS;
} else if(\OC_Config::getValue('maintenance', false)) { } else if(\OC_Config::getValue('maintenance', false)) {
//Possible scenario: ownCloud core is updated but an app failed //Possible scenario: ownCloud core is updated but an app failed
$output->writeln('ownCloud is in maintenance mode'); $output->writeln('<warning>ownCloud is in maintenance mode</warning>');
$output->write('Maybe an upgrade is already in process. Please check the ' $output->write('<comment>Maybe an upgrade is already in process. Please check the '
. 'logfile (data/owncloud.log). If you want to re-run the ' . 'logfile (data/owncloud.log). If you want to re-run the '
. 'upgrade procedure, remove the "maintenance mode" from ' . 'upgrade procedure, remove the "maintenance mode" from '
. 'config.php and call this script again.' . 'config.php and call this script again.</comment>'
, true); , true);
return self::ERROR_MAINTENANCE_MODE; return self::ERROR_MAINTENANCE_MODE;
} else { } else {
$output->writeln('ownCloud is already latest version'); $output->writeln('<info>ownCloud is already latest version</info>');
return self::ERROR_UP_TO_DATE; return self::ERROR_UP_TO_DATE;
} }
} }