aboutsummaryrefslogtreecommitdiffstats
path: root/core/Command
diff options
context:
space:
mode:
authorCôme Chilliet <91878298+come-nc@users.noreply.github.com>2024-04-30 14:29:07 +0200
committerGitHub <noreply@github.com>2024-04-30 14:29:07 +0200
commitf02ca82825999b05284aebbd87ca851a7e49ee28 (patch)
tree71d28f0fb0ae334edd25bb2c3a6b242883316234 /core/Command
parent66aad438ad548345bef03f8c44d024fb259582a2 (diff)
parent38e809e635969b17bccd12118e2e8c09f7421bd9 (diff)
downloadnextcloud-server-f02ca82825999b05284aebbd87ca851a7e49ee28.tar.gz
nextcloud-server-f02ca82825999b05284aebbd87ca851a7e49ee28.zip
Merge pull request #44829 from nextcloud/feat/add-storage-tree-to-info-file
feat(occ): Add --storage-tree option to info:file to help debug storages
Diffstat (limited to 'core/Command')
-rw-r--r--core/Command/Info/File.php17
1 files changed, 14 insertions, 3 deletions
diff --git a/core/Command/Info/File.php b/core/Command/Info/File.php
index 4afda280370..576ca1e4fd8 100644
--- a/core/Command/Info/File.php
+++ b/core/Command/Info/File.php
@@ -41,7 +41,8 @@ class File extends Command {
->setName('info:file')
->setDescription('get information for a file')
->addArgument('file', InputArgument::REQUIRED, "File id or path")
- ->addOption('children', 'c', InputOption::VALUE_NONE, "List children of folders");
+ ->addOption('children', 'c', InputOption::VALUE_NONE, "List children of folders")
+ ->addOption('storage-tree', null, InputOption::VALUE_NONE, "Show storage and cache wrapping tree");
}
public function execute(InputInterface $input, OutputInterface $output): int {
@@ -86,7 +87,7 @@ class File extends Command {
$output->writeln(" children: " . count($children) . " (use <info>--children</info> option to list)");
}
}
- $this->outputStorageDetails($node->getMountPoint(), $node, $output);
+ $this->outputStorageDetails($node->getMountPoint(), $node, $input, $output);
$filesPerUser = $this->fileUtils->getFilesByUser($node);
$output->writeln("");
@@ -108,7 +109,7 @@ class File extends Command {
* @psalm-suppress UndefinedClass
* @psalm-suppress UndefinedInterfaceMethod
*/
- private function outputStorageDetails(IMountPoint $mountPoint, Node $node, OutputInterface $output): void {
+ private function outputStorageDetails(IMountPoint $mountPoint, Node $node, InputInterface $input, OutputInterface $output): void {
$storage = $mountPoint->getStorage();
if (!$storage) {
return;
@@ -151,5 +152,15 @@ class File extends Command {
} elseif ($mountPoint instanceof GroupMountPoint) {
$output->writeln(" groupfolder id: " . $mountPoint->getFolderId());
}
+ if ($input->getOption('storage-tree')) {
+ $storageTmp = $storage;
+ $storageClass = get_class($storageTmp).' (cache:'.get_class($storageTmp->getCache()).')';
+ while ($storageTmp instanceof \OC\Files\Storage\Wrapper\Wrapper) {
+ $storageTmp = $storageTmp->getWrapperStorage();
+ $storageClass .= "\n\t".'> '.get_class($storageTmp).' (cache:'.get_class($storageTmp->getCache()).')';
+ }
+ $output->writeln(" storage wrapping: " . $storageClass);
+ }
+
}
}