Skip to content

Commit

Permalink
DbResourcePage: Warn the user if Icinga DB is used as configuration d…
Browse files Browse the repository at this point in the history
…atabase
  • Loading branch information
sukhwinder33445 committed Apr 9, 2024
1 parent efea832 commit ddaf05a
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions modules/setup/application/forms/DbResourcePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ protected function validateConfiguration()
return false;
}

$state = true;
$state = false;
$connectionError = null;

try {
Expand All @@ -129,12 +129,19 @@ protected function validateConfiguration()
$connectionError = $e;
}

if ($connectionError === null && array_search('icinga_instances', $db->listTables(), true) !== false) {
$tables = $db->listTables();
if ($connectionError === null
&& (
in_array('icinga_instances', $tables, true)
|| in_array('icingadb_instance', $tables, 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 2 seems to be the one of Icinga'
. ' OR Icingadb. 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.'
));
$state = false;
}
Expand Down

0 comments on commit ddaf05a

Please sign in to comment.