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.

deleteconfig.php 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * @author Arthur Schiwon <blizzz@owncloud.com>
  4. * @author Martin Konrad <info@martin-konrad.net>
  5. * @author Morris Jobke <hey@morrisjobke.de>
  6. *
  7. * @copyright Copyright (c) 2015, ownCloud, Inc.
  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 OCA\user_ldap\Command;
  24. use Symfony\Component\Console\Command\Command;
  25. use Symfony\Component\Console\Input\InputArgument;
  26. use Symfony\Component\Console\Input\InputInterface;
  27. use Symfony\Component\Console\Output\OutputInterface;
  28. use \OCA\user_ldap\lib\Helper;
  29. class DeleteConfig extends Command {
  30. /** @var \OCA\User_LDAP\lib\Helper */
  31. protected $helper;
  32. /**
  33. * @param Helper $helper
  34. */
  35. public function __construct(Helper $helper) {
  36. $this->helper = $helper;
  37. parent::__construct();
  38. }
  39. protected function configure() {
  40. $this
  41. ->setName('ldap:delete-config')
  42. ->setDescription('deletes an existing LDAP configuration')
  43. ->addArgument(
  44. 'configID',
  45. InputArgument::REQUIRED,
  46. 'the configuration ID'
  47. )
  48. ;
  49. }
  50. protected function execute(InputInterface $input, OutputInterface $output) {
  51. $configPrefix = $input->getArgument('configID');
  52. $success = $this->helper->deleteServerConfiguration($configPrefix);
  53. if($success) {
  54. $output->writeln("Deleted configuration with configID '{$configPrefix}'");
  55. } else {
  56. $output->writeln("Cannot delete configuration with configID '{$configPrefix}'");
  57. }
  58. }
  59. }