Merge pull request #56410 from nextcloud/fix/maintenance-cache-key

fix(Memcache): use different cache key when in maintenance mode
This commit is contained in:
Ferdinand Thiessen 2025-12-01 16:47:10 +01:00 committed by GitHub
commit 1fdcfed1f7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -113,12 +113,16 @@ class Factory implements ICacheFactory {
protected function getGlobalPrefix(): string {
if ($this->globalPrefix === null) {
$config = \OCP\Server::get(SystemConfig::class);
$maintenanceMode = $config->getValue('maintenance', false);
$versions = [];
if ($config->getValue('installed', false)) {
if ($config->getValue('installed', false) && !$maintenanceMode) {
$appConfig = \OCP\Server::get(IAppConfig::class);
// only get the enabled apps to clear the cache in case an app is enabled or disabled (e.g. clear routes)
$versions = $appConfig->getAppInstalledVersions(true);
ksort($versions);
} else {
// if not installed or in maintenance mode, we should distinguish between both states.
$versions['core:maintenance'] = $maintenanceMode ? '1' : '0';
}
$versions['core'] = implode('.', $this->serverVersion->getVersion());