correct db-exists check in installation-process

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2021-10-10 14:32:02 +02:00
parent 52135a1d3a
commit db1df84ef1

View File

@@ -791,7 +791,8 @@ class FroxlorInstall
$tables_exist = true;
}
if ($tables_exist && (int)$this->_data['mysql_forcecreate'] > 0) {
if ($tables_exist) {
if ((int)$this->_data['mysql_forcecreate'] > 0) {
// set status
$content .= $this->_status_message('orange', 'exists (' . $this->_data['mysql_database'] . ')');
// tell what's going on
@@ -812,7 +813,7 @@ class FroxlorInstall
// create temporary .cnf file
$cnffilename = "/tmp/froxlor_dump.cnf";
$dumpcnf = "[mysqldump]".PHP_EOL."password=\"".$this->_data['mysql_root_pass']."\"".PHP_EOL;
$dumpcnf = "[mysqldump]" . PHP_EOL . "password=\"" . $this->_data['mysql_root_pass'] . "\"" . PHP_EOL;
file_put_contents($cnffilename, $dumpcnf);
if ($do_backup) {
@@ -820,7 +821,7 @@ class FroxlorInstall
$output = [];
exec($command, $output);
@unlink($cnffilename);
if (stristr(implode(" ", $output), "error") || !file_exists($filename)) {
if (stristr(implode(" ", $output), "error") || ! file_exists($filename)) {
$content .= $this->_status_message('red', $this->_lng['install']['backup_failed']);
$this->_abort = true;
} else {
@@ -834,6 +835,7 @@ class FroxlorInstall
$content .= $this->_status_message('red', $this->_lng['install']['db_exists']);
$this->_abort = true;
}
}
return $content;
}