Relax schema check

Checking one table for its existence is more than enough. Creating a diff
implies conditional CREATE TABLE instructions and the like, what we want
to avoid.

refs #7163
This commit is contained in:
Johannes Meyer 2014-10-08 11:24:05 +02:00
parent 647447b4d2
commit baa6abdb00
2 changed files with 3 additions and 13 deletions

View File

@ -272,8 +272,7 @@ class WebInstaller implements Installer
));
}
$diff = array_diff(array('account', 'preference'), $db->listTables());
if (empty($diff)) {
if (array_search('account', $db->listTables()) !== false) {
$this->log(t('Database schema already exists...'));
} else {
$this->log(t('Creating database schema...'));
@ -337,8 +336,7 @@ class WebInstaller implements Installer
));
}
$diff = array_diff(array('account', 'preference'), $db->listTables());
if (empty($diff)) {
if (array_search('account', $db->listTables()) !== false) {
$this->log(t('Database schema already exists...'));
} else {
$this->log(t('Creating database schema...'));

View File

@ -29,13 +29,6 @@ use Icinga\Application\Platform;
*/
class WebSetup extends Wizard implements SetupWizard
{
/**
* The database tables required by Icinga Web 2
*
* @var array
*/
protected $databaseTables = array('account', 'preference');
/**
* The privileges required by Icinga Web 2 to setup the database
*
@ -148,8 +141,7 @@ class WebSetup extends Wizard implements SetupWizard
try {
$db->connectToDb();
$diff = array_diff($this->databaseTables, $db->listTables());
if (false === empty($diff)) {
if (array_search('account', $db->listTables()) === false) {
$skip = $db->checkPrivileges($this->databaseSetupPrivileges);
} else {
$skip = true;