Skip to content

Commit a7862d0

Browse files
authored
Merge pull request #726 from nextcloud/backport/723/stable31
2 parents 58ad632 + c9905b8 commit a7862d0

File tree

4 files changed

+16
-14
lines changed

4 files changed

+16
-14
lines changed

index.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -758,19 +758,14 @@ private function getDownloadedFilePath(): string {
758758
*
759759
* @throws \Exception
760760
*/
761-
public function verifyIntegrity(?string $urlOverride = null): void {
761+
public function verifyIntegrity(): void {
762762
$this->silentLog('[info] verifyIntegrity()');
763763

764764
if ($this->getCurrentReleaseChannel() === 'daily') {
765765
$this->silentLog('[info] current channel is "daily" which is not signed. Skipping verification.');
766766
return;
767767
}
768768

769-
if ($urlOverride) {
770-
$this->silentLog('[info] custom download url provided, cannot verify signature');
771-
return;
772-
}
773-
774769
$response = $this->getUpdateServerResponse();
775770
if (empty($response['signature'])) {
776771
throw new \Exception('No signature specified for defined update');

lib/UpdateCommand.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class UpdateCommand extends Command {
2121
protected bool $shouldStop = false;
2222
protected bool $skipBackup = false;
2323
protected bool $skipUpgrade = false;
24+
protected bool $skipIntegrityCheck = false;
2425
protected string $urlOverride = '';
2526

2627
/** @var list<string> strings of text for stages of updater */
@@ -47,7 +48,8 @@ protected function configure(): void {
4748
->setHelp("This command fetches the latest code that is announced via the updater server and safely replaces the existing code with the new one.")
4849
->addOption('no-backup', null, InputOption::VALUE_NONE, 'Skip backup of current Nextcloud version')
4950
->addOption('no-upgrade', null, InputOption::VALUE_NONE, "Don't automatically run occ upgrade")
50-
->addOption('url', null, InputOption::VALUE_OPTIONAL, 'The URL of the Nextcloud release to download');
51+
->addOption('url', null, InputOption::VALUE_OPTIONAL, 'The URL of the Nextcloud release to download')
52+
->addOption('no-verify', null, InputOption::VALUE_OPTIONAL, 'Skip integrity verification of the downloaded file');
5153
}
5254

5355
public static function getUpdaterVersion(): string {
@@ -62,6 +64,7 @@ public static function getUpdaterVersion(): string {
6264
protected function execute(InputInterface $input, OutputInterface $output) {
6365
$this->skipBackup = (bool)$input->getOption('no-backup');
6466
$this->skipUpgrade = (bool)$input->getOption('no-upgrade');
67+
$this->skipIntegrityCheck = (bool)$input->getOption('no-verify');
6568
$this->urlOverride = (string)$input->getOption('url');
6669

6770
$version = static::getUpdaterVersion();
@@ -143,6 +146,11 @@ protected function execute(InputInterface $input, OutputInterface $output) {
143146
$updateString = $this->updater->checkForUpdate();
144147
}
145148

149+
if ($this->skipIntegrityCheck) {
150+
$this->updater->log('[warn] Integrity check of the downloaded file will be skipped');
151+
$output->writeln('Integrity check of the downloaded file will be skipped.');
152+
}
153+
146154
$output->writeln('');
147155

148156
$lines = explode('<br />', $updateString);
@@ -373,7 +381,11 @@ protected function executeStep(int $step): array {
373381
$this->updater->downloadUpdate($this->urlOverride);
374382
break;
375383
case 5:
376-
$this->updater->verifyIntegrity($this->urlOverride);
384+
if ($this->skipIntegrityCheck) {
385+
$this->updater->silentLog('[info] Skipping integrity check as requested');
386+
break;
387+
}
388+
$this->updater->verifyIntegrity();
377389
break;
378390
case 6:
379391
$this->updater->extractDownload();

lib/Updater.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -720,19 +720,14 @@ private function getDownloadedFilePath(): string {
720720
*
721721
* @throws \Exception
722722
*/
723-
public function verifyIntegrity(?string $urlOverride = null): void {
723+
public function verifyIntegrity(): void {
724724
$this->silentLog('[info] verifyIntegrity()');
725725

726726
if ($this->getCurrentReleaseChannel() === 'daily') {
727727
$this->silentLog('[info] current channel is "daily" which is not signed. Skipping verification.');
728728
return;
729729
}
730730

731-
if ($urlOverride) {
732-
$this->silentLog('[info] custom download url provided, cannot verify signature');
733-
return;
734-
}
735-
736731
$response = $this->getUpdateServerResponse();
737732
if (empty($response['signature'])) {
738733
throw new \Exception('No signature specified for defined update');

updater.phar

410 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)