disable.php 978 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * Copyright (c) 2013 Robin Appelman <icewind@owncloud.com>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. */
  8. namespace OC\Core\Command\App;
  9. use Symfony\Component\Console\Command\Command;
  10. use Symfony\Component\Console\Input\InputArgument;
  11. use Symfony\Component\Console\Input\InputInterface;
  12. use Symfony\Component\Console\Output\OutputInterface;
  13. class Disable extends Command {
  14. protected function configure() {
  15. $this
  16. ->setName('app:disable')
  17. ->setDescription('disable an app')
  18. ->addArgument(
  19. 'app-id',
  20. InputArgument::REQUIRED,
  21. 'disable the specified app'
  22. );
  23. }
  24. protected function execute(InputInterface $input, OutputInterface $output) {
  25. $appId = $input->getArgument('app-id');
  26. if (\OC_App::isEnabled($appId)) {
  27. \OC_App::disable($appId);
  28. $output->writeln($appId . ' disabled');
  29. } else {
  30. $output->writeln('No such app enabled: ' . $appId);
  31. }
  32. }
  33. }