feat: show object store instance in info:file

Signed-off-by: Robin Appelman <robin@icewind.nl>
pull/54922/head
Robin Appelman 1 month ago
parent b3f29e1039
commit 29cb19da80
No known key found for this signature in database
GPG Key ID: 42B69D8A64526EFB
  1. 21
      core/Command/Info/File.php

@ -8,6 +8,7 @@ declare(strict_types=1);
namespace OC\Core\Command\Info;
use OC\Files\ObjectStore\ObjectStoreStorage;
use OC\Files\ObjectStore\PrimaryObjectStoreConfig;
use OC\Files\Storage\Wrapper\Encryption;
use OC\Files\Storage\Wrapper\Wrapper;
use OC\Files\View;
@ -36,6 +37,7 @@ class File extends Command {
IFactory $l10nFactory,
private FileUtils $fileUtils,
private \OC\Encryption\Util $encryptionUtil,
private PrimaryObjectStoreConfig $objectStoreConfig,
) {
$this->l10n = $l10nFactory->get('core');
parent::__construct();
@ -145,6 +147,25 @@ class File extends Command {
$parts = explode(':', $objectStoreId);
/** @var string $bucket */
$bucket = array_pop($parts);
if ($this->objectStoreConfig->hasMultipleObjectStorages()) {
$configs = $this->objectStoreConfig->getObjectStoreConfigs();
foreach ($configs as $instance => $config) {
if (is_array($config)) {
if ($config['arguments']['multibucket']) {
if (str_starts_with($bucket, $config['arguments']['bucket'])) {
$postfix = substr($bucket, strlen($config['arguments']['bucket']));
if (is_numeric($postfix)) {
$output->writeln(' object store instance: ' . $instance);
}
}
} else {
if ($config['arguments']['bucket'] === $bucket) {
$output->writeln(' object store instance: ' . $instance);
}
}
}
}
}
$output->writeln(' bucket: ' . $bucket);
if ($node instanceof \OC\Files\Node\File) {
$output->writeln(' object id: ' . $storage->getURN($node->getId()));

Loading…
Cancel
Save