fix(Memcache): use different cache key when in maintenance mode

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
pull/56410/head
Ferdinand Thiessen 2025-11-12 22:21:43 +07:00
parent e89a8d832c
commit 15229e0b4e
No known key found for this signature in database
GPG Key ID: 45FAE7268762B400
1 changed files with 5 additions and 1 deletions

@ -113,12 +113,16 @@ class Factory implements ICacheFactory {
protected function getGlobalPrefix(): string { protected function getGlobalPrefix(): string {
if ($this->globalPrefix === null) { if ($this->globalPrefix === null) {
$config = \OCP\Server::get(SystemConfig::class); $config = \OCP\Server::get(SystemConfig::class);
$maintenanceMode = $config->getValue('maintenance', false);
$versions = []; $versions = [];
if ($config->getValue('installed', false)) { if ($config->getValue('installed', false) && !$maintenanceMode) {
$appConfig = \OCP\Server::get(IAppConfig::class); $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) // 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); $versions = $appConfig->getAppInstalledVersions(true);
ksort($versions); 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()); $versions['core'] = implode('.', $this->serverVersion->getVersion());