Merge pull request #56061 from nextcloud/backport/56033/stable32

[stable32] fix(Memcache): ensure global prefix depends on enabled apps
pull/56066/head
Ferdinand Thiessen 2025-10-28 18:49:13 +07:00 committed by GitHub
commit 72a3754be0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 2 deletions

@ -116,13 +116,16 @@ class Factory implements ICacheFactory {
$versions = [];
if ($config->getValue('installed', false)) {
$appConfig = \OCP\Server::get(IAppConfig::class);
$versions = $appConfig->getAppInstalledVersions();
// 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);
}
$versions['core'] = implode('.', $this->serverVersion->getVersion());
// Include instanceid in the prefix, in case multiple instances use the same cache (e.g. same FPM pool)
$instanceid = $config->getValue('instanceid');
$this->globalPrefix = hash('xxh128', $instanceid . implode(',', $versions));
$installedApps = implode(',', array_keys($versions)) . implode(',', array_values($versions));
$this->globalPrefix = hash('xxh128', $instanceid . $installedApps);
}
return $this->globalPrefix;
}