DbResourcePage: Warn the user if Icinga DB is used as configuration database

This commit is contained in:
Sukhwinder Dhillon 2024-04-09 17:23:04 +02:00 committed by Johannes Meyer
parent c27ca26dad
commit 62cae50f1e
1 changed files with 11 additions and 5 deletions

View File

@ -129,12 +129,18 @@ class DbResourcePage extends Form
$connectionError = $e;
}
if ($connectionError === null && array_search('icinga_instances', $db->listTables(), true) !== false) {
if ($connectionError === null
&& (
in_array('icinga_instances', $db->listTables(), true)
|| in_array('icingadb_instance', $db->listTables(), true)
)
) {
$this->warning($this->translate(
'The database you\'ve configured to use for Icinga Web 2 seems to be the one of Icinga. Please be aware'
. ' that this database configuration is supposed to be used for Icinga Web 2\'s configuration and that'
. ' it is highly recommended to not mix different schemas in the same database. If this is intentional,'
. ' you can skip the validation and ignore this warning. If not, please provide a different database.'
'The database you\'ve configured to use for Icinga Web seems to be the one of Icinga 2'
. ' / Icinga DB. Please be aware that this database configuration is supposed to be used for'
. ' Icinga Web\'s configuration and that it is highly recommended to not mix different schemas'
. ' in the same database. If this is intentional, you can skip the validation and ignore this'
. ' warning. If not, please provide a different database.'
));
$state = false;
}