Skip to content

Commit

Permalink
fix: set mimetype_version during upgrade to the old version
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 committed Jun 19, 2024
1 parent d3d2488 commit 523346e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/private/Repair/RepairMimeTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,11 @@ public function migrationsAvailable(): bool {
}

private function getMimeTypeVersion(): string {
$serverVersion = $this->config->getSystemValueString('version', '0.0.0');
// 29.0.0.10 is the last version with a mimetype migration before it was moved to a separate version number
if (version_compare($serverVersion, '29.0.0.10', '>')) {
return $this->config->getAppValue('files', 'mimetype_version', '29.0.0.10');
} else {
return $serverVersion;
$mimeVersion = $this->config->getAppValue('files', 'mimetype_version', '');
if ($mimeVersion) {
return $mimeVersion;
}
return $this->config->getSystemValueString('version', '0.0.0');
}

/**
Expand Down
4 changes: 4 additions & 0 deletions lib/private/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ public function upgrade(): bool {
$installedVersion = $this->config->getSystemValueString('version', '0.0.0');
$currentVersion = implode('.', \OCP\Util::getVersion());

if ($this->config->getAppValue('files', 'mimetype_version', '') === '') {
$this->config->setAppValue('files', 'mimetype_version', $installedVersion);
}

$this->log->debug('starting upgrade from ' . $installedVersion . ' to ' . $currentVersion, ['app' => 'core']);

$success = true;
Expand Down

0 comments on commit 523346e

Please sign in to comment.