Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable17] [CLI only] Add option to skip backup. #295

Merged
merged 1 commit into from
Jul 30, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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