diff options
Diffstat (limited to 'core/Command/Info/File.php')
-rw-r--r-- | core/Command/Info/File.php | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/core/Command/Info/File.php b/core/Command/Info/File.php index e86d8d0a5bd..0a3006ac1d7 100644 --- a/core/Command/Info/File.php +++ b/core/Command/Info/File.php @@ -34,7 +34,7 @@ class File extends Command { private FileUtils $fileUtils, private \OC\Encryption\Util $encryptionUtil ) { - $this->l10n = $l10nFactory->get("core"); + $this->l10n = $l10nFactory->get('core'); parent::__construct(); $this->rootView = new View(); } @@ -43,9 +43,9 @@ class File extends Command { $this ->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('storage-tree', null, InputOption::VALUE_NONE, "Show storage and cache wrapping tree"); + ->addArgument('file', InputArgument::REQUIRED, 'File id or path') + ->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 { @@ -58,50 +58,50 @@ class File extends Command { } $output->writeln($node->getName()); - $output->writeln(" fileid: " . $node->getId()); - $output->writeln(" mimetype: " . $node->getMimetype()); - $output->writeln(" modified: " . (string)$this->l10n->l("datetime", $node->getMTime())); - $output->writeln(" " . ($node->isEncrypted() ? "encrypted" : "not encrypted")); + $output->writeln(' fileid: ' . $node->getId()); + $output->writeln(' mimetype: ' . $node->getMimetype()); + $output->writeln(' modified: ' . (string)$this->l10n->l('datetime', $node->getMTime())); + $output->writeln(' ' . ($node->isEncrypted() ? 'encrypted' : 'not encrypted')); if ($node->isEncrypted()) { $keyPath = $this->encryptionUtil->getFileKeyDir('', $node->getPath()); if ($this->rootView->file_exists($keyPath)) { - $output->writeln(" encryption key at: " . $keyPath); + $output->writeln(' encryption key at: ' . $keyPath); } else { - $output->writeln(" <error>encryption key not found</error> should be located at: " . $keyPath); + $output->writeln(' <error>encryption key not found</error> should be located at: ' . $keyPath); } } - $output->writeln(" size: " . Util::humanFileSize($node->getSize())); - $output->writeln(" etag: " . $node->getEtag()); + $output->writeln(' size: ' . Util::humanFileSize($node->getSize())); + $output->writeln(' etag: ' . $node->getEtag()); if ($node instanceof Folder) { $children = $node->getDirectoryListing(); $childSize = array_sum(array_map(function (Node $node) { return $node->getSize(); }, $children)); if ($childSize != $node->getSize()) { - $output->writeln(" <error>warning: folder has a size of " . Util::humanFileSize($node->getSize()) ." but it's children sum up to " . Util::humanFileSize($childSize) . "</error>."); - $output->writeln(" Run <info>occ files:scan --path " . $node->getPath() . "</info> to attempt to resolve this."); + $output->writeln(' <error>warning: folder has a size of ' . Util::humanFileSize($node->getSize()) ." but it's children sum up to " . Util::humanFileSize($childSize) . '</error>.'); + $output->writeln(' Run <info>occ files:scan --path ' . $node->getPath() . '</info> to attempt to resolve this.'); } if ($showChildren) { - $output->writeln(" children: " . count($children) . ":"); + $output->writeln(' children: ' . count($children) . ':'); foreach ($children as $child) { - $output->writeln(" - " . $child->getName()); + $output->writeln(' - ' . $child->getName()); } } else { - $output->writeln(" children: " . count($children) . " (use <info>--children</info> option to list)"); + $output->writeln(' children: ' . count($children) . ' (use <info>--children</info> option to list)'); } } $this->outputStorageDetails($node->getMountPoint(), $node, $input, $output); $filesPerUser = $this->fileUtils->getFilesByUser($node); - $output->writeln(""); - $output->writeln("The following users have access to the file"); - $output->writeln(""); + $output->writeln(''); + $output->writeln('The following users have access to the file'); + $output->writeln(''); foreach ($filesPerUser as $user => $files) { $output->writeln("$user:"); foreach ($files as $userFile) { - $output->writeln(" " . $userFile->getPath() . ": " . $this->fileUtils->formatPermissions($userFile->getType(), $userFile->getPermissions())); + $output->writeln(' ' . $userFile->getPath() . ': ' . $this->fileUtils->formatPermissions($userFile->getType(), $userFile->getPermissions())); $mount = $userFile->getMountPoint(); - $output->writeln(" " . $this->fileUtils->formatMountType($mount)); + $output->writeln(' ' . $this->fileUtils->formatMountType($mount)); } } @@ -118,7 +118,7 @@ class File extends Command { return; } if (!$storage->instanceOfStorage(IHomeStorage::class)) { - $output->writeln(" mounted at: " . $mountPoint->getMountPoint()); + $output->writeln(' mounted at: ' . $mountPoint->getMountPoint()); } if ($storage->instanceOfStorage(ObjectStoreStorage::class)) { /** @var ObjectStoreStorage $storage */ @@ -126,9 +126,9 @@ class File extends Command { $parts = explode(':', $objectStoreId); /** @var string $bucket */ $bucket = array_pop($parts); - $output->writeln(" bucket: " . $bucket); + $output->writeln(' bucket: ' . $bucket); if ($node instanceof \OC\Files\Node\File) { - $output->writeln(" object id: " . $storage->getURN($node->getId())); + $output->writeln(' object id: ' . $storage->getURN($node->getId())); try { $fh = $node->fopen('r'); if (!$fh) { @@ -137,23 +137,23 @@ class File extends Command { $stat = fstat($fh); fclose($fh); if ($stat['size'] !== $node->getSize()) { - $output->writeln(" <error>warning: object had a size of " . $stat['size'] . " but cache entry has a size of " . $node->getSize() . "</error>. This should have been automatically repaired"); + $output->writeln(' <error>warning: object had a size of ' . $stat['size'] . ' but cache entry has a size of ' . $node->getSize() . '</error>. This should have been automatically repaired'); } } catch (\Exception $e) { - $output->writeln(" <error>warning: object not found in bucket</error>"); + $output->writeln(' <error>warning: object not found in bucket</error>'); } } } else { if (!$storage->file_exists($node->getInternalPath())) { - $output->writeln(" <error>warning: file not found in storage</error>"); + $output->writeln(' <error>warning: file not found in storage</error>'); } } if ($mountPoint instanceof ExternalMountPoint) { $storageConfig = $mountPoint->getStorageConfig(); - $output->writeln(" external storage id: " . $storageConfig->getId()); - $output->writeln(" external type: " . $storageConfig->getBackend()->getText()); + $output->writeln(' external storage id: ' . $storageConfig->getId()); + $output->writeln(' external type: ' . $storageConfig->getBackend()->getText()); } elseif ($mountPoint instanceof GroupMountPoint) { - $output->writeln(" groupfolder id: " . $mountPoint->getFolderId()); + $output->writeln(' groupfolder id: ' . $mountPoint->getFolderId()); } if ($input->getOption('storage-tree')) { $storageTmp = $storage; @@ -162,7 +162,7 @@ class File extends Command { $storageTmp = $storageTmp->getWrapperStorage(); $storageClass .= "\n\t".'> '.get_class($storageTmp).' (cache:'.get_class($storageTmp->getCache()).')'; } - $output->writeln(" storage wrapping: " . $storageClass); + $output->writeln(' storage wrapping: ' . $storageClass); } } |