Skip to content

Commit

Permalink
Merge pull request #460 from nextcloud/add-no-upgrade-option
Browse files Browse the repository at this point in the history
feat: Add --no-upgrade option to skip calling occ upgrade after update
  • Loading branch information
blizzz authored Feb 7, 2023
2 parents b607243 + 08a8f7b commit f3afb79
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/UpdateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* @copyright Copyright (c) 2016 Morris Jobke <hey@morrisjobke.de>
* @copyright Copyright (c) 2017 Lukas Reschke <lukas@statuscode.ch>
*
* @author Thomas Citharel <nextcloud@tcit.fr>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -38,6 +40,8 @@ class UpdateCommand extends Command {
/** @var bool */
protected $skipBackup = false;

protected bool $skipUpgrade = false;

/** @var array strings of text for stages of updater */
protected $checkTexts = [
0 => '',
Expand All @@ -60,7 +64,8 @@ protected function configure() {
->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.")
->addOption('no-backup', null, InputOption::VALUE_NONE, 'Skip backup of current Nextcloud version');
->addOption('no-backup', null, InputOption::VALUE_NONE, 'Skip backup of current Nextcloud version')
->addOption('no-upgrade', null, InputOption::VALUE_NONE, "Don't automatically run occ upgrade");
}

public static function getUpdaterVersion(): string {
Expand All @@ -74,6 +79,7 @@ public static function getUpdaterVersion(): string {

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

$version = static::getUpdaterVersion();
$output->writeln('Nextcloud Updater - version: ' . $version);
Expand Down Expand Up @@ -278,6 +284,12 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$this->updater->log('[info] update of code successful.');
$output->writeln('Update of code successful.');

if ($this->skipUpgrade) {
$output->writeln('Please now execute "./occ upgrade" to finish the upgrade.');
$this->updater->log('[info] updater finished');
return 0;
}

if ($input->isInteractive()) {
$output->writeln('');

Expand Down
Binary file modified updater.phar
Binary file not shown.

0 comments on commit f3afb79

Please sign in to comment.