Export.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /**
  3. * @author Robin Appelman <icewind@owncloud.com>
  4. *
  5. * @copyright Copyright (c) 2016, ownCloud, Inc.
  6. * @license AGPL-3.0
  7. *
  8. * This code is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU Affero General Public License, version 3,
  10. * as published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU Affero General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Affero General Public License, version 3,
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>
  19. *
  20. */
  21. namespace OCA\Files_External\Command;
  22. use Symfony\Component\Console\Command\Command;
  23. use Symfony\Component\Console\Helper\Table;
  24. use Symfony\Component\Console\Helper\TableHelper;
  25. use Symfony\Component\Console\Input\ArrayInput;
  26. use Symfony\Component\Console\Input\InputArgument;
  27. use Symfony\Component\Console\Input\InputInterface;
  28. use Symfony\Component\Console\Input\InputOption;
  29. use Symfony\Component\Console\Input\Input;
  30. use Symfony\Component\Console\Output\OutputInterface;
  31. class Export extends ListCommand {
  32. protected function configure() {
  33. $this
  34. ->setName('files_external:export')
  35. ->setDescription('Export mount configurations')
  36. ->addArgument(
  37. 'user_id',
  38. InputArgument::OPTIONAL,
  39. 'user id to export the personal mounts for, if no user is provided admin mounts will be exported'
  40. )->addOption(
  41. 'all',
  42. 'a',
  43. InputOption::VALUE_NONE,
  44. 'show both system wide mounts and all personal mounts'
  45. );
  46. }
  47. protected function execute(InputInterface $input, OutputInterface $output) {
  48. $listCommand = new ListCommand($this->globalService, $this->userService, $this->userSession, $this->userManager);
  49. $listInput = new ArrayInput([], $listCommand->getDefinition());
  50. $listInput->setArgument('user_id', $input->getArgument('user_id'));
  51. $listInput->setOption('all', $input->getOption('all'));
  52. $listInput->setOption('output', 'json_pretty');
  53. $listInput->setOption('show-password', true);
  54. $listInput->setOption('full', true);
  55. $listCommand->execute($listInput, $output);
  56. }
  57. }