Skip to content

Commit f3afb79

Browse files
authored
Merge pull request #460 from nextcloud/add-no-upgrade-option
feat: Add --no-upgrade option to skip calling occ upgrade after update
2 parents b607243 + 08a8f7b commit f3afb79

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

lib/UpdateCommand.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* @copyright Copyright (c) 2016 Morris Jobke <hey@morrisjobke.de>
44
* @copyright Copyright (c) 2017 Lukas Reschke <lukas@statuscode.ch>
55
*
6+
* @author Thomas Citharel <nextcloud@tcit.fr>
7+
*
68
* @license GNU AGPL version 3 or any later version
79
*
810
* This program is free software: you can redistribute it and/or modify
@@ -38,6 +40,8 @@ class UpdateCommand extends Command {
3840
/** @var bool */
3941
protected $skipBackup = false;
4042

43+
protected bool $skipUpgrade = false;
44+
4145
/** @var array strings of text for stages of updater */
4246
protected $checkTexts = [
4347
0 => '',
@@ -60,7 +64,8 @@ protected function configure() {
6064
->setName('update')
6165
->setDescription('Updates the code of an Nextcloud instance')
6266
->setHelp("This command fetches the latest code that is announced via the updater server and safely replaces the existing code with the new one.")
63-
->addOption('no-backup', null, InputOption::VALUE_NONE, 'Skip backup of current Nextcloud version');
67+
->addOption('no-backup', null, InputOption::VALUE_NONE, 'Skip backup of current Nextcloud version')
68+
->addOption('no-upgrade', null, InputOption::VALUE_NONE, "Don't automatically run occ upgrade");
6469
}
6570

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

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

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

287+
if ($this->skipUpgrade) {
288+
$output->writeln('Please now execute "./occ upgrade" to finish the upgrade.');
289+
$this->updater->log('[info] updater finished');
290+
return 0;
291+
}
292+
281293
if ($input->isInteractive()) {
282294
$output->writeln('');
283295

updater.phar

428 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)