Add setup related utility functions to ApplicationBootstrap.php
This commit is contained in:
parent
7d36a59c67
commit
611d01788f
|
@ -113,6 +113,13 @@ abstract class ApplicationBootstrap
|
|||
*/
|
||||
protected $isWeb = false;
|
||||
|
||||
/**
|
||||
* Whether Icinga Web 2 requires setup
|
||||
*
|
||||
* @type bool
|
||||
*/
|
||||
protected $requiresSetup = false;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
@ -393,6 +400,40 @@ abstract class ApplicationBootstrap
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the setup module if Icinga Web 2 requires setup
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
protected function loadSetupModuleIfNecessary()
|
||||
{
|
||||
if (! @file_exists($this->config->resolvePath('config.ini'))) {
|
||||
$this->requiresSetup = true;
|
||||
$this->moduleManager->loadModule('setup');
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get whether Icinga Web 2 requires setup
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function requiresSetup()
|
||||
{
|
||||
return $this->requiresSetup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get whether the setup token exists
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function setupTokenExists()
|
||||
{
|
||||
return @file_exists($this->config->resolvePath('setup.token'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup default logging
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue