mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-21 04:44:25 +02:00
DatabaseStep: Fix schema checks
The step to setup the database considered any table of foreign schemas as one of our own schema, causing it to never create our schema for non-empty databases. fixes #9799
This commit is contained in:
parent
9b051cd7ce
commit
c32b749701
@ -65,7 +65,7 @@ class DatabaseStep extends Step
|
|||||||
$db->reconnect($this->data['resourceConfig']['dbname']);
|
$db->reconnect($this->data['resourceConfig']['dbname']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_search(key($this->data['tables']), $db->listTables()) !== false) {
|
if (array_search(reset($this->data['tables']), $db->listTables()) !== false) {
|
||||||
$this->log(mt('setup', 'Database schema already exists...'));
|
$this->log(mt('setup', 'Database schema already exists...'));
|
||||||
} else {
|
} else {
|
||||||
$this->log(mt('setup', 'Creating database schema...'));
|
$this->log(mt('setup', 'Creating database schema...'));
|
||||||
@ -116,7 +116,7 @@ class DatabaseStep extends Step
|
|||||||
$db->reconnect($this->data['resourceConfig']['dbname']);
|
$db->reconnect($this->data['resourceConfig']['dbname']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_search(key($this->data['tables']), $db->listTables()) !== false) {
|
if (array_search(reset($this->data['tables']), $db->listTables()) !== false) {
|
||||||
$this->log(mt('setup', 'Database schema already exists...'));
|
$this->log(mt('setup', 'Database schema already exists...'));
|
||||||
} else {
|
} else {
|
||||||
$this->log(mt('setup', 'Creating database schema...'));
|
$this->log(mt('setup', 'Creating database schema...'));
|
||||||
@ -163,7 +163,7 @@ class DatabaseStep extends Step
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$db->connectToDb();
|
$db->connectToDb();
|
||||||
if (array_search(key($this->data['tables']), $db->listTables()) === false) {
|
if (array_search(reset($this->data['tables']), $db->listTables()) === false) {
|
||||||
if ($resourceConfig['username'] !== $this->data['resourceConfig']['username']) {
|
if ($resourceConfig['username'] !== $this->data['resourceConfig']['username']) {
|
||||||
$message = sprintf(
|
$message = sprintf(
|
||||||
mt(
|
mt(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user