You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.7 KiB

10 years ago
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Björn Schießle <bjoern@schiessle.org>
  6. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  7. * @author Joas Schilling <coding@schilljs.com>
  8. *
  9. * @license AGPL-3.0
  10. *
  11. * This code is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU Affero General Public License, version 3,
  13. * as published by the Free Software Foundation.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License, version 3,
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>
  22. *
  23. */
  24. namespace OC\Core\Command\Encryption;
  25. use OC\Encryption\Util;
  26. use Symfony\Component\Console\Command\Command;
  27. use Symfony\Component\Console\Input\InputInterface;
  28. use Symfony\Component\Console\Output\OutputInterface;
  29. class ShowKeyStorageRoot extends Command {
  30. /** @var Util */
  31. protected $util;
  32. /**
  33. * @param Util $util
  34. */
  35. public function __construct(Util $util) {
  36. parent::__construct();
  37. $this->util = $util;
  38. }
  39. protected function configure() {
  40. parent::configure();
  41. $this
  42. ->setName('encryption:show-key-storage-root')
  43. ->setDescription('Show current key storage root');
  44. }
  45. protected function execute(InputInterface $input, OutputInterface $output): int {
  46. $currentRoot = $this->util->getKeyStorageRoot();
  47. $rootDescription = $currentRoot !== '' ? $currentRoot : 'default storage location (data/)';
  48. $output->writeln("Current key storage root: <info>$rootDescription</info>");
  49. return 0;
  50. }
  51. }