mirror of
https://github.com/nextcloud/server.git
synced 2026-04-22 23:03:00 -04:00
feat: show object store instance in info:file
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
bc9104066d
commit
1ac2ea877e
1 changed files with 21 additions and 0 deletions
|
|
@ -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…
Reference in a new issue