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