aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files/ObjectStore/PrimaryObjectStoreConfig.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Files/ObjectStore/PrimaryObjectStoreConfig.php')
-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;
}
}