aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-06-06 11:42:14 +0200
committerVincent Petry <pvince81@owncloud.com>2014-06-06 11:42:14 +0200
commitff1296927629c922d5e606019915f2cdde07a330 (patch)
tree46eda7060a7e5ad13f494bf6e9653d56abd803fd /core
parent289accc31bd2adb98833e470162483119924e2e9 (diff)
parent5e27ac3e0d99c272dfb1c50cf7265cd8e329558c (diff)
downloadnextcloud-server-ff1296927629c922d5e606019915f2cdde07a330.tar.gz
nextcloud-server-ff1296927629c922d5e606019915f2cdde07a330.zip
Merge pull request #8905 from owncloud/update-cli-skipcheckmigrate
Added CLI arguments for upgrade simulation steps
Diffstat (limited to 'core')
-rw-r--r--core/command/upgrade.php45
1 files changed, 42 insertions, 3 deletions
diff --git a/core/command/upgrade.php b/core/command/upgrade.php
index c3946d2aab5..d037082c5e8 100644
--- a/core/command/upgrade.php
+++ b/core/command/upgrade.php
@@ -12,6 +12,7 @@ use OC\Updater;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Input\InputOption;
class Upgrade extends Command {
@@ -19,12 +20,24 @@ class Upgrade extends Command {
const ERROR_NOT_INSTALLED = 1;
const ERROR_MAINTENANCE_MODE = 2;
const ERROR_UP_TO_DATE = 3;
+ const ERROR_INVALID_ARGUMENTS = 4;
protected function configure() {
$this
->setName('upgrade')
->setDescription('run upgrade routines')
- ;
+ ->addOption(
+ '--skip-migration-test',
+ null,
+ InputOption::VALUE_NONE,
+ 'skips the database schema migration simulation and update directly'
+ )
+ ->addOption(
+ '--dry-run',
+ null,
+ InputOption::VALUE_NONE,
+ 'only runs the database schema migration simulation, do not actually update'
+ );
}
/**
@@ -43,15 +56,41 @@ class Upgrade extends Command {
return self::ERROR_NOT_INSTALLED;
}
+ $simulateStepEnabled = true;
+ $updateStepEnabled = true;
+
+ if ($input->getOption('skip-migration-test')) {
+ $simulateStepEnabled = false;
+ }
+ if ($input->getOption('dry-run')) {
+ $updateStepEnabled = false;
+ }
+
+ if (!$simulateStepEnabled && !$updateStepEnabled) {
+ $output->writeln(
+ '<error>Only one of "--skip-migration-test" or "--dry-run" ' .
+ 'can be specified at a time.</error>'
+ );
+ return self::ERROR_INVALID_ARGUMENTS;
+ }
+
if(\OC::checkUpgrade(false)) {
$updater = new Updater();
+ $updater->setSimulateStepEnabled($simulateStepEnabled);
+ $updater->setUpdateStepEnabled($updateStepEnabled);
+
$updater->listen('\OC\Updater', 'maintenanceStart', function () use($output) {
$output->writeln('<info>Turned on maintenance mode</info>');
});
- $updater->listen('\OC\Updater', 'maintenanceEnd', function () use($output) {
+ $updater->listen('\OC\Updater', 'maintenanceEnd', function () use($output, $updateStepEnabled) {
$output->writeln('<info>Turned off maintenance mode</info>');
- $output->writeln('<info>Update successful</info>');
+ if (!$updateStepEnabled) {
+ $output->writeln('<info>Update simulation successful</info>');
+ }
+ else {
+ $output->writeln('<info>Update successful</info>');
+ }
});
$updater->listen('\OC\Updater', 'dbUpgrade', function () use($output) {
$output->writeln('<info>Updated database</info>');