cli/setup: Remove is_string checks for switches of the webserver generation

This commit is contained in:
Eric Lippmann 2014-12-30 18:49:47 +01:00
parent b5747797b7
commit 80730e0bb2
1 changed files with 8 additions and 6 deletions

View File

@ -123,18 +123,20 @@ class ConfigCommand extends Command
} catch (ProgrammingError $e) { } catch (ProgrammingError $e) {
$this->fail($this->translate('Unknown type') . ': ' . $type); $this->fail($this->translate('Unknown type') . ': ' . $type);
} }
$urlPath = $this->params->get('path', $webserver->getUrlPath()); $urlPath = trim($this->params->get('path', $webserver->getUrlPath()));
if (! is_string($urlPath) || strlen(trim($urlPath)) === 0) { if (strlen($urlPath) === 0) {
$this->fail($this->translate('The argument --path expects a URL path')); $this->fail($this->translate('The argument --path expects a URL path'));
} }
$documentRoot = $this->params->get('root', $this->params->get('document-root', $webserver->getDocumentRoot())); $documentRoot = trim(
if (! is_string($documentRoot) || strlen(trim($documentRoot)) === 0) { $this->params->get('root', $this->params->get('document-root', $webserver->getDocumentRoot()))
);
if (strlen($documentRoot) === 0) {
$this->fail($this->translate( $this->fail($this->translate(
'The argument --root/--document-root expects a directory from which the webserver will serve files' 'The argument --root/--document-root expects a directory from which the webserver will serve files'
)); ));
} }
$configDir = $this->params->get('config', $webserver->getConfigDir()); $configDir = trim($this->params->get('config', $webserver->getConfigDir()));
if (! is_string($configDir) || strlen(trim($configDir)) === 0) { if (strlen($configDir) === 0) {
$this->fail($this->translate( $this->fail($this->translate(
'The argument --config expects a path to Icinga Web 2\'s configuration files' 'The argument --config expects a path to Icinga Web 2\'s configuration files'
)); ));