diff --git a/lib/private/Repair/RepairMimeTypes.php b/lib/private/Repair/RepairMimeTypes.php index a9ef95b50c28e..cd8c610c3b037 100644 --- a/lib/private/Repair/RepairMimeTypes.php +++ b/lib/private/Repair/RepairMimeTypes.php @@ -389,13 +389,11 @@ public function migrationsAvailable(): bool { * Get the current mimetype version */ 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->appConfig->getValueString('files', 'mimetype_version', '29.0.0.10'); - } - - return $serverVersion; + // 29.0.0.10 is the last version with a mimetype migration before tracking was moved to mimetype_version. + // However since it's possible that someone may have upgraded without running expensive repair steps prior + // to 29.0.0.10, we assume none have been ran (once). This is acceptable since (a) only happens when expensive + // repair steps are explicitly requested; (b) only happens once *ever* in a given environment. + return $this->appConfig->getValueString('files', 'mimetype_version', '0.0.0'); } /** diff --git a/lib/private/Setup.php b/lib/private/Setup.php index efdbd1cfd6c57..8536321677a4d 100644 --- a/lib/private/Setup.php +++ b/lib/private/Setup.php @@ -508,6 +508,10 @@ public function install(array $options, ?IOutput $output = null): array { } } + // Seed the mimetype_version for future mimetype repair jobs with the install-time version + $serverVersion = $config->getSystemValueString('version', '0.0.0'); + $appConfig->setValueString('files', 'mimetype_version', $serverVersion); + // Dispatch installation completed event $adminUsername = !$disableAdminUser ? ($options['adminlogin'] ?? null) : null; $adminEmail = !empty($options['adminemail']) ? $options['adminemail'] : null;