enable.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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 Enable extends Command {
  14. protected function configure() {
  15. $this
  16. ->setName('app:enable')
  17. ->setDescription('enable an app')
  18. ->addArgument(
  19. 'app-id',
  20. InputArgument::REQUIRED,
  21. 'enable 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. $output->writeln($appId . ' is already enabled');
  28. } else if (!\OC_App::getAppPath($appId)) {
  29. $output->writeln($appId . ' not found');
  30. } else {
  31. \OC_App::enable($appId);
  32. $output->writeln($appId . ' enabled');
  33. }
  34. }
  35. }