register_command.php 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. use OCA\Files_External\Command\ListCommand;
  22. use OCA\Files_External\Command\Config;
  23. use OCA\Files_External\Command\Option;
  24. use OCA\Files_External\Command\Applicable;
  25. use OCA\Files_External\Command\Import;
  26. use OCA\Files_External\Command\Export;
  27. use OCA\Files_External\Command\Delete;
  28. use OCA\Files_External\Command\Create;
  29. use OCA\Files_External\Command\Backends;
  30. use OCA\Files_External\Command\Verify;
  31. $userManager = OC::$server->getUserManager();
  32. $userSession = OC::$server->getUserSession();
  33. $groupManager = OC::$server->getGroupManager();
  34. $app = \OC_Mount_Config::$app;
  35. $globalStorageService = $app->getContainer()->query('\OCA\Files_external\Service\GlobalStoragesService');
  36. $userStorageService = $app->getContainer()->query('\OCA\Files_external\Service\UserStoragesService');
  37. $importLegacyStorageService = $app->getContainer()->query('\OCA\Files_external\Service\ImportLegacyStoragesService');
  38. $backendService = $app->getContainer()->query('OCA\Files_External\Service\BackendService');
  39. /** @var Symfony\Component\Console\Application $application */
  40. $application->add(new ListCommand($globalStorageService, $userStorageService, $userSession, $userManager));
  41. $application->add(new Config($globalStorageService));
  42. $application->add(new Option($globalStorageService));
  43. $application->add(new Applicable($globalStorageService, $userManager, $groupManager));
  44. $application->add(new Import($globalStorageService, $userStorageService, $userSession, $userManager, $importLegacyStorageService, $backendService));
  45. $application->add(new Export($globalStorageService, $userStorageService, $userSession, $userManager));
  46. $application->add(new Delete($globalStorageService, $userStorageService, $userSession, $userManager));
  47. $application->add(new Create($globalStorageService, $userStorageService, $userManager, $userSession, $backendService));
  48. $application->add(new Backends($backendService));
  49. $application->add(new Verify($globalStorageService));