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.

Check.php 975B

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