Skip to content

Commit 1ac2ea8

Browse files
icewind1991AndyScherzinger
authored andcommitted
feat: show object store instance in info:file
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent bc91040 commit 1ac2ea8

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

core/Command/Info/File.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace OC\Core\Command\Info;
99

1010
use OC\Files\ObjectStore\ObjectStoreStorage;
11+
use OC\Files\ObjectStore\PrimaryObjectStoreConfig;
1112
use OC\Files\Storage\Wrapper\Encryption;
1213
use OC\Files\Storage\Wrapper\Wrapper;
1314
use OC\Files\View;
@@ -36,6 +37,7 @@ public function __construct(
3637
IFactory $l10nFactory,
3738
private FileUtils $fileUtils,
3839
private \OC\Encryption\Util $encryptionUtil,
40+
private PrimaryObjectStoreConfig $objectStoreConfig,
3941
) {
4042
$this->l10n = $l10nFactory->get('core');
4143
parent::__construct();
@@ -145,6 +147,25 @@ private function outputStorageDetails(IMountPoint $mountPoint, Node $node, Input
145147
$parts = explode(':', $objectStoreId);
146148
/** @var string $bucket */
147149
$bucket = array_pop($parts);
150+
if ($this->objectStoreConfig->hasMultipleObjectStorages()) {
151+
$configs = $this->objectStoreConfig->getObjectStoreConfigs();
152+
foreach ($configs as $instance => $config) {
153+
if (is_array($config)) {
154+
if ($config['arguments']['multibucket']) {
155+
if (str_starts_with($bucket, $config['arguments']['bucket'])) {
156+
$postfix = substr($bucket, strlen($config['arguments']['bucket']));
157+
if (is_numeric($postfix)) {
158+
$output->writeln(' object store instance: ' . $instance);
159+
}
160+
}
161+
} else {
162+
if ($config['arguments']['bucket'] === $bucket) {
163+
$output->writeln(' object store instance: ' . $instance);
164+
}
165+
}
166+
}
167+
}
168+
}
148169
$output->writeln(' bucket: ' . $bucket);
149170
if ($node instanceof \OC\Files\Node\File) {
150171
$output->writeln(' object id: ' . $storage->getURN($node->getId()));

0 commit comments

Comments
 (0)