Add setup related utility functions to ApplicationBootstrap.php

This commit is contained in:
Eric Lippmann 2014-12-29 14:29:31 +01:00
parent 7d36a59c67
commit 611d01788f
1 changed files with 41 additions and 0 deletions

View File

@ -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
*