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.

41 lines
843 B

  1. <?php
  2. namespace OC\Core\Command;
  3. use OCP\IConfig;
  4. use Symfony\Component\Console\Input\InputInterface;
  5. use Symfony\Component\Console\Output\OutputInterface;
  6. class Check extends Base {
  7. /**
  8. * @var IConfig
  9. */
  10. private $config;
  11. public function __construct(IConfig $config) {
  12. parent::__construct();
  13. $this->config = $config;
  14. }
  15. protected function configure() {
  16. parent::configure();
  17. $this
  18. ->setName('check')
  19. ->setDescription('check dependencies of the server environment')
  20. ;
  21. }
  22. protected function execute(InputInterface $input, OutputInterface $output) {
  23. $errors = \OC_Util::checkServer($this->config);
  24. if (!empty($errors)) {
  25. $errors = array_map(function($item) {
  26. return (string) $item['error'];
  27. }, $errors);
  28. $this->writeArrayInOutputFormat($input, $output, $errors);
  29. return 1;
  30. }
  31. return 0;
  32. }
  33. }