Skip to content

Commit

Permalink
Merge pull request #295 from nextcloud/backport/292/stable17
Browse files Browse the repository at this point in the history
[stable17] [CLI only] Add option to skip backup.
  • Loading branch information
MorrisJobke authored Jul 30, 2020
2 parents 96234eb + 3eda43f commit 37aa490
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/UpdateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ class UpdateCommand extends Command {
/** @var bool */
protected $shouldStop = false;

/** @var bool */
protected $skipBackup = false;

/** @var array strings of text for stages of updater */
protected $checkTexts = [
0 => '',
Expand All @@ -58,10 +61,12 @@ protected function configure() {
$this
->setName('update')
->setDescription('Updates the code of an Nextcloud instance')
->setHelp("This command fetches the latest code that is announced via the updater server and safely replaces the existing code with the new one.");
->setHelp("This command fetches the latest code that is announced via the updater server and safely replaces the existing code with the new one.")
->addOption('no-backup', null, InputOption::VALUE_NONE, 'Skip backup of current Nextcloud version');
}

protected function execute(InputInterface $input, OutputInterface $output) {
$this->skipBackup = $input->getOption('no-backup');

if (class_exists('NC\Updater\Version')) {
$versionClass = new Version();
Expand Down Expand Up @@ -353,7 +358,9 @@ protected function executeStep($step) {
$this->updater->checkWritePermissions();
break;
case 3:
$this->updater->createBackup();
if ($this->skipBackup === false) {
$this->updater->createBackup();
}
break;
case 4:
$this->updater->downloadUpdate();
Expand Down

0 comments on commit 37aa490

Please sign in to comment.