aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2025-06-10 19:47:30 +0200
committerRobin Appelman <robin@icewind.nl>2025-06-12 17:52:31 +0200
commit2acc97cc251dfaee9013be1f4075c6d26ce3309c (patch)
tree7e80901b50c76ceb5f860c4eee50f5faf313c1cd /lib/private
parentc7feb2998391dbb0537987ff9c6fe9e592243c37 (diff)
downloadnextcloud-server-multi-object-store.tar.gz
nextcloud-server-multi-object-store.zip
fix: only store object store config for user when multiple object stores are enabledmulti-object-store
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/Files/ObjectStore/PrimaryObjectStoreConfig.php19
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/private/Files/ObjectStore/PrimaryObjectStoreConfig.php b/lib/private/Files/ObjectStore/PrimaryObjectStoreConfig.php
index 6d265c8e664..65ee8c0df6c 100644
--- a/lib/private/Files/ObjectStore/PrimaryObjectStoreConfig.php
+++ b/lib/private/Files/ObjectStore/PrimaryObjectStoreConfig.php
@@ -99,6 +99,11 @@ class PrimaryObjectStoreConfig {
return $objectStore || $objectStoreMultiBucket;
}
+ public function hasMultipleObjectStorages(): bool {
+ $objectStore = $this->config->getSystemValue('objectstore', []);
+ return isset($objectStore['default']);
+ }
+
/**
* @return ?array<string, ObjectStoreConfig|string>
*/
@@ -204,11 +209,15 @@ class PrimaryObjectStoreConfig {
}
public function getObjectStoreForUser(IUser $user): string {
- $value = $this->config->getUserValue($user->getUID(), 'homeobjectstore', 'objectstore', null);
- if ($value === null) {
- $value = $this->resolveAlias('default');
- $this->config->setUserValue($user->getUID(), 'homeobjectstore', 'objectstore', $value);
+ if ($this->hasMultipleObjectStorages()) {
+ $value = $this->config->getUserValue($user->getUID(), 'homeobjectstore', 'objectstore', null);
+ if ($value === null) {
+ $value = $this->resolveAlias('default');
+ $this->config->setUserValue($user->getUID(), 'homeobjectstore', 'objectstore', $value);
+ }
+ return $value;
+ } else {
+ return 'default';
}
- return $value;
}
}