ShowKeyStorageRoot.php 1.7 KB

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