parent
627a19a2a9
commit
1136a09741
|
@ -52,46 +52,28 @@ class WebInstaller implements Installer
|
||||||
$configIniPath = Config::resolvePath('config.ini');
|
$configIniPath = Config::resolvePath('config.ini');
|
||||||
try {
|
try {
|
||||||
$this->writeConfigIni($configIniPath);
|
$this->writeConfigIni($configIniPath);
|
||||||
$this->report[] = (object) array(
|
$this->log(sprintf(t('Successfully created: %s'), $configIniPath));
|
||||||
'state' => true,
|
|
||||||
'message' => sprintf(t('Successfully created: %s'), $configIniPath)
|
|
||||||
);
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$success = false;
|
$success = false;
|
||||||
$this->report[] = (object) array(
|
$this->log(sprintf(t('Unable to create: %s (%s)'), $configIniPath, $e->getMessage()), false);
|
||||||
'state' => false,
|
|
||||||
'message' => sprintf(t('Unable to create: %s (%s)'), $configIniPath, $e->getMessage())
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$resourcesIniPath = Config::resolvePath('resources.ini');
|
$resourcesIniPath = Config::resolvePath('resources.ini');
|
||||||
try {
|
try {
|
||||||
$this->writeResourcesIni($resourcesIniPath);
|
$this->writeResourcesIni($resourcesIniPath);
|
||||||
$this->report[] = (object) array(
|
$this->log(sprintf(t('Successfully created: %s'), $resourcesIniPath));
|
||||||
'state' => true,
|
|
||||||
'message' => sprintf(t('Successfully created: %s'), $resourcesIniPath)
|
|
||||||
);
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$success = false;
|
$success = false;
|
||||||
$this->report[] = (object) array(
|
$this->log(sprintf(t('Unable to create: %s (%s)'), $resourcesIniPath, $e->getMessage()), false);
|
||||||
'state' => false,
|
|
||||||
'message' => sprintf(t('Unable to create: %s (%s)'), $resourcesIniPath, $e->getMessage())
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$authenticationIniPath = Config::resolvePath('authentication.ini');
|
$authenticationIniPath = Config::resolvePath('authentication.ini');
|
||||||
try {
|
try {
|
||||||
$this->writeAuthenticationIni($authenticationIniPath);
|
$this->writeAuthenticationIni($authenticationIniPath);
|
||||||
$this->report[] = (object) array(
|
$this->log(sprintf(t('Successfully created: %s'), $authenticationIniPath));
|
||||||
'state' => true,
|
|
||||||
'message' => sprintf(t('Successfully created: %s'), $authenticationIniPath)
|
|
||||||
);
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$success = false;
|
$success = false;
|
||||||
$this->report[] = (object) array(
|
$this->log(sprintf(t('Unable to create: %s (%s)'), $authenticationIniPath, $e->getMessage()), false);
|
||||||
'state' => false,
|
|
||||||
'message' => sprintf(t('Unable to create: %s (%s)'), $authenticationIniPath, $e->getMessage())
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $success;
|
return $success;
|
||||||
|
@ -365,7 +347,10 @@ class WebInstaller implements Installer
|
||||||
try {
|
try {
|
||||||
$db->connectToDb();
|
$db->connectToDb();
|
||||||
$message = sprintf(
|
$message = sprintf(
|
||||||
t('The database user "%s" will be used to setup the missing schema required by Icinga Web 2 in database "%s".'),
|
t(
|
||||||
|
'The database user "%s" will be used to setup the missing'
|
||||||
|
. ' schema required by Icinga Web 2 in database "%s".'
|
||||||
|
),
|
||||||
$this->pageData['setup_database_creation']['username'],
|
$this->pageData['setup_database_creation']['username'],
|
||||||
$resourceConfig['dbname']
|
$resourceConfig['dbname']
|
||||||
);
|
);
|
||||||
|
@ -394,4 +379,18 @@ class WebInstaller implements Installer
|
||||||
{
|
{
|
||||||
return $this->report;
|
return $this->report;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a message to the report
|
||||||
|
*
|
||||||
|
* @param string $message The message to add
|
||||||
|
* @param bool $success Whether the message represents a success (true) or a failure (false)
|
||||||
|
*/
|
||||||
|
protected function log($message, $success = true)
|
||||||
|
{
|
||||||
|
$this->report[] = (object) array(
|
||||||
|
'state' => (bool) $success,
|
||||||
|
'message' => $message
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue