Skip to content
Closed
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,11 @@ public function verifyIntegrity() {
return;
}

if ($urlOverride) {
$this->silentLog('[info] custom download url provided, cannot verify signature');
return;
}

$response = $this->getUpdateServerResponse();
if (empty($response['signature'])) {
throw new \Exception('No signature specified for defined update');
Expand Down
23 changes: 16 additions & 7 deletions lib/UpdateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class UpdateCommand extends Command {
protected $skipBackup = false;

protected bool $skipUpgrade = false;
protected string $urlOverride = '';

/** @var array strings of text for stages of updater */
protected $checkTexts = [
Expand All @@ -65,7 +66,8 @@ protected function configure() {
->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-upgrade', null, InputOption::VALUE_NONE, "Don't automatically run occ upgrade");
->addOption('no-upgrade', null, InputOption::VALUE_NONE, "Don't automatically run occ upgrade")
->addOption('url', null, InputOption::VALUE_OPTIONAL, 'The URL of the Nextcloud release to download');
}

public static function getUpdaterVersion(): string {
Expand Down Expand Up @@ -152,7 +154,12 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$output->writeln('Current version is ' . $this->updater->getCurrentVersion() . '.');

// needs to be called that early because otherwise updateAvailable() returns false
$updateString = $this->updater->checkForUpdate();
if ($this->urlOverride) {
$this->updater->log('[info] Using URL override: ' . $this->urlOverride);
$updateString = 'Update check forced with URL override: ' . $this->urlOverride;
} else {
$updateString = $this->updater->checkForUpdate();
}

$output->writeln('');

Expand All @@ -165,9 +172,11 @@ protected function execute(InputInterface $input, OutputInterface $output) {

$output->writeln('');

if (!$this->updater->updateAvailable() && $stepNumber === 0) {
$output->writeln('Nothing to do.');
return 0;
if (!$this->urlOverride) {
if (!$this->updater->updateAvailable() && $stepNumber === 0) {
$output->writeln('Nothing to do.');
return 0;
}
}

$questionText = 'Start update';
Expand Down Expand Up @@ -374,10 +383,10 @@ protected function executeStep($step) {
}
break;
case 4:
$this->updater->downloadUpdate();
$this->updater->downloadUpdate($this->urlOverride);
break;
case 5:
$this->updater->verifyIntegrity();
$this->updater->verifyIntegrity($this->urlOverride);
break;
case 6:
$this->updater->extractDownload();
Expand Down
5 changes: 5 additions & 0 deletions lib/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,11 @@ public function verifyIntegrity() {
return;
}

if ($urlOverride) {
$this->silentLog('[info] custom download url provided, cannot verify signature');
return;
}

$response = $this->getUpdateServerResponse();
if (empty($response['signature'])) {
throw new \Exception('No signature specified for defined update');
Expand Down
5 changes: 2 additions & 3 deletions vendor/composer/platform_check.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
}
}
trigger_error(
'Composer detected issues in your platform: ' . implode(' ', $issues),
E_USER_ERROR
throw new \RuntimeException(
'Composer detected issues in your platform: ' . implode(' ', $issues)
);
}