ShowKeyStorageRoot.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OC\Core\Command\Encryption;
  8. use OC\Encryption\Util;
  9. use Symfony\Component\Console\Command\Command;
  10. use Symfony\Component\Console\Input\InputInterface;
  11. use Symfony\Component\Console\Output\OutputInterface;
  12. class ShowKeyStorageRoot extends Command {
  13. public function __construct(
  14. protected Util $util,
  15. ) {
  16. parent::__construct();
  17. }
  18. protected function configure() {
  19. parent::configure();
  20. $this
  21. ->setName('encryption:show-key-storage-root')
  22. ->setDescription('Show current key storage root');
  23. }
  24. protected function execute(InputInterface $input, OutputInterface $output): int {
  25. $currentRoot = $this->util->getKeyStorageRoot();
  26. $rootDescription = $currentRoot !== '' ? $currentRoot : 'default storage location (data/)';
  27. $output->writeln("Current key storage root: <info>$rootDescription</info>");
  28. return 0;
  29. }
  30. }