mirror of
https://github.com/nextcloud/server.git
synced 2026-04-20 22:00:39 -04:00
fix(Memcache): ensure global prefix depends on enabled apps
- ensure the prefix is changed when an app is (dis)enabled - ensure the app ids are included in the hash instead of only the version numbers - ensure hash is deterministic by always use the same order. Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
parent
8bba3e31a1
commit
866bc8e239
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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue