WebCommand::serveAction(): rename parameter $basedir to $documentRoot

resolves #10683
This commit is contained in:
Alexander A. Klimov 2015-11-20 17:59:13 +01:00
parent 5b898d5f3b
commit 15154308d1

View File

@ -21,7 +21,7 @@ class WebCommand extends Command
} }
$fork = $this->params->get('daemonize'); $fork = $this->params->get('daemonize');
$basedir = $this->params->shift(); $documentRoot = $this->params->shift();
$socket = $this->params->shift(); $socket = $this->params->shift();
// TODO: Sanity check!! // TODO: Sanity check!!
@ -29,23 +29,23 @@ class WebCommand extends Command
$socket = '0.0.0.0:80'; $socket = '0.0.0.0:80';
// throw new IcingaException('Socket is required'); // throw new IcingaException('Socket is required');
} }
if ($basedir === null) { if ($documentRoot === null) {
$basedir = Icinga::app()->getBaseDir('public'); $documentRoot = Icinga::app()->getBaseDir('public');
if (! file_exists($basedir) || ! is_dir($basedir)) { if (! file_exists($documentRoot) || ! is_dir($documentRoot)) {
throw new IcingaException('Basedir is required'); throw new IcingaException('Document root directory is required');
} }
} }
$basedir = realpath($basedir); $documentRoot = realpath($documentRoot);
if ($fork) { if ($fork) {
$this->forkAndExit(); $this->forkAndExit();
} }
echo "Serving Icingaweb from $basedir\n"; echo "Serving Icingaweb from $documentRoot\n";
$cmd = sprintf( $cmd = sprintf(
'%s -S %s -t %s %s', '%s -S %s -t %s %s',
readlink('/proc/self/exe'), readlink('/proc/self/exe'),
$socket, $socket,
$basedir, $documentRoot,
Icinga::app()->getLibraryDir('/Icinga/Application/webrouter.php') Icinga::app()->getLibraryDir('/Icinga/Application/webrouter.php')
); );