|
11 | 11 | use OC\Files\ObjectStore\PrimaryObjectStoreConfig; |
12 | 12 | use OC\Files\Storage\Wrapper\Encryption; |
13 | 13 | use OC\Files\Storage\Wrapper\Wrapper; |
14 | | -use OC\Files\View; |
15 | 14 | use OCA\Files_External\Config\ExternalMountPoint; |
16 | 15 | use OCA\GroupFolders\Mount\GroupMountPoint; |
17 | 16 | use OCP\Files\File as OCPFile; |
18 | 17 | use OCP\Files\Folder; |
19 | 18 | use OCP\Files\IHomeStorage; |
| 19 | +use OCP\Files\IRootFolder; |
20 | 20 | use OCP\Files\Mount\IMountPoint; |
21 | 21 | use OCP\Files\Node; |
22 | 22 | use OCP\Files\NotFoundException; |
|
31 | 31 |
|
32 | 32 | class File extends Command { |
33 | 33 | private IL10N $l10n; |
34 | | - private View $rootView; |
35 | 34 |
|
36 | 35 | public function __construct( |
37 | 36 | IFactory $l10nFactory, |
38 | 37 | private FileUtils $fileUtils, |
39 | 38 | private \OC\Encryption\Util $encryptionUtil, |
40 | 39 | private PrimaryObjectStoreConfig $objectStoreConfig, |
| 40 | + private IRootFolder $rootFolder, |
41 | 41 | ) { |
42 | 42 | $this->l10n = $l10nFactory->get('core'); |
43 | 43 | parent::__construct(); |
44 | | - $this->rootView = new View(); |
45 | 44 | } |
46 | 45 |
|
47 | 46 | protected function configure(): void { |
@@ -70,9 +69,10 @@ public function execute(InputInterface $input, OutputInterface $output): int { |
70 | 69 | if ($node instanceof OCPFile && $node->isEncrypted()) { |
71 | 70 | $output->writeln(' ' . 'server-side encrypted: yes'); |
72 | 71 | $keyPath = $this->encryptionUtil->getFileKeyDir('', $node->getPath()); |
73 | | - if ($this->rootView->file_exists($keyPath)) { |
| 72 | + try { |
| 73 | + $this->rootFolder->get($keyPath); |
74 | 74 | $output->writeln(' encryption key at: ' . $keyPath); |
75 | | - } else { |
| 75 | + } catch (NotFoundException $e) { |
76 | 76 | $output->writeln(' <error>encryption key not found</error> should be located at: ' . $keyPath); |
77 | 77 | } |
78 | 78 | $storage = $node->getStorage(); |
|
0 commit comments