Skip to content
Merged
Changes from 1 commit
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
Next Next commit
feat: Add --no-upgrade option to skip calling occ upgrade after update
This can be useful in scenarios running non-interactively but wanting to do both things separately

Signed-off-by: Thomas Citharel <[email protected]>
  • Loading branch information
tcitworld committed Feb 7, 2023
commit 3510e62cb5d52f052dc3efe132e6a45e1e1b33c6
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 <[email protected]>
* @copyright Copyright (c) 2017 Lukas Reschke <[email protected]>
*
* @author Thomas Citharel <[email protected]>
*
* @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