2015-04-07 18:19:23 -04:00
|
|
|
<?php
|
2024-05-24 13:43:47 -04:00
|
|
|
|
2015-06-25 05:43:55 -04:00
|
|
|
/**
|
2024-05-24 13:43:47 -04:00
|
|
|
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2015-06-25 05:43:55 -04:00
|
|
|
*/
|
2015-04-07 18:19:23 -04:00
|
|
|
namespace OC\Core\Command;
|
|
|
|
|
|
2017-03-17 18:37:48 -04:00
|
|
|
use OC\SystemConfig;
|
2015-04-07 18:19:23 -04:00
|
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
|
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
|
|
2015-04-09 05:45:07 -04:00
|
|
|
class Check extends Base {
|
2023-06-20 11:30:21 -04:00
|
|
|
public function __construct(
|
|
|
|
|
private SystemConfig $config,
|
|
|
|
|
) {
|
2015-04-07 18:19:23 -04:00
|
|
|
parent::__construct();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected function configure() {
|
2015-04-09 05:45:07 -04:00
|
|
|
parent::configure();
|
|
|
|
|
|
2015-04-07 18:19:23 -04:00
|
|
|
$this
|
|
|
|
|
->setName('check')
|
|
|
|
|
->setDescription('check dependencies of the server environment')
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-26 08:54:51 -04:00
|
|
|
protected function execute(InputInterface $input, OutputInterface $output): int {
|
2015-04-07 18:19:23 -04:00
|
|
|
$errors = \OC_Util::checkServer($this->config);
|
|
|
|
|
if (!empty($errors)) {
|
2020-04-09 07:53:40 -04:00
|
|
|
$errors = array_map(function ($item) {
|
2024-08-23 09:10:27 -04:00
|
|
|
return (string)$item['error'];
|
2015-04-07 18:19:23 -04:00
|
|
|
}, $errors);
|
2015-04-09 05:45:07 -04:00
|
|
|
|
|
|
|
|
$this->writeArrayInOutputFormat($input, $output, $errors);
|
2015-04-07 18:19:23 -04:00
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|