setName("onlyoffice:documentserver")
->setDescription("Manage document server")
->addOption(
"check",
null,
InputOption::VALUE_NONE,
"Check connection document server"
);
}
/**
* Executes the current command.
*
* @param InputInterface $input - input data
* @param OutputInterface $output - output data
*
* @return int 0 if everything went fine, or an exit code
*/
protected function execute(InputInterface $input, OutputInterface $output): int {
$check = $input->getOption("check");
$documentserver = $this->appConfig->getDocumentServerUrl(true);
if (empty($documentserver)) {
$output->writeln("Document server is not configured");
return 1;
}
if ($check) {
[$error, $version] = $this->documentService->checkDocServiceUrl();
$this->appConfig->setSettingsError($error);
if (!empty($error)) {
$output->writeln("Error connection: $error");
return 1;
} else {
$output->writeln("Document server $documentserver version $version is successfully connected");
return 0;
}
}
$output->writeln("The current document server: $documentserver");
return 0;
}
}