Commit 305dda70 authored by Marius Cramer's avatar Marius Cramer

- changed some things in mysql lib for installer

parent 64060a4c
......@@ -449,10 +449,8 @@ if($install_mode == 'standard') {
// initialize the connection to the master database
$inst->dbmaster = new db();
if($inst->dbmaster->linkId) $inst->dbmaster->closeConn();
$inst->dbmaster->dbHost = $conf['mysql']["master_host"];
$inst->dbmaster->dbName = $conf['mysql']["master_database"];
$inst->dbmaster->dbUser = $conf['mysql']["master_admin_user"];
$inst->dbmaster->dbPass = $conf['mysql']["master_admin_password"];
$inst->dbmaster->setDBData($conf['mysql']["master_host"], $conf['mysql']["master_admin_user"], $conf['mysql']["master_admin_password"]);
$inst->dbmaster->setDBName($conf['mysql']["master_database"]);
} else {
// the master DB is the same then the slave DB
......
......@@ -172,7 +172,7 @@ class installer_base {
}
//* Set the database name in the DB library
$this->db->dbName = $conf['mysql']['database'];
$this->db->setDBName($conf['mysql']['database']);
//* Load the database dump into the database, if database contains no tables
$db_tables = $this->db->getTables();
......@@ -224,7 +224,7 @@ class installer_base {
$this->db->query('FLUSH PRIVILEGES;');
//* Set the database name in the DB library
$this->db->dbName = $conf['mysql']['database'];
$this->db->setDBName($conf['mysql']['database']);
$tpl_ini_array = ini_to_array(rf('tpl/server.ini.master'));
......
......@@ -69,7 +69,7 @@ class db extends mysqli
if($this->_iConnId) return true;
$this->dbHost = $conf["mysql"]["host"];
$this->dbName = $conf["mysql"]["database"];
$this->dbName = false;//$conf["mysql"]["database"];
$this->dbUser = $conf["mysql"]["admin_user"];
$this->dbPass = $conf["mysql"]["admin_password"];
$this->dbCharset = $conf["mysql"]["charset"];
......@@ -90,13 +90,25 @@ class db extends mysqli
$this->_sqlerror('Zugriff auf Datenbankserver fehlgeschlagen! / Database server not accessible!');
return false;
}
if($this->dbName) $this->setDBName($this->dbName);
$this->_setCharset();
}
public function setDBData($host, $user, $password) {
$this->dbHost = $host;
$this->dbUser = $user;
$this->dbPass = $password;
}
public function setDBName($name) {
$this->dbName = $name;
if(!((bool)mysqli_query( $this->_iConnId, 'USE `' . $this->dbName . '`'))) {
$this->close();
$this->_sqlerror('Datenbank nicht gefunden / Database not found');
return false;
}
$this->_setCharset();
}
public function close() {
......
......@@ -267,10 +267,8 @@ if($conf['mysql']['master_slave_setup'] == 'y') {
// initialize the connection to the master database
$inst->dbmaster = new db();
if($inst->dbmaster->linkId) $inst->dbmaster->closeConn();
$inst->dbmaster->dbHost = $conf['mysql']["master_host"];
$inst->dbmaster->dbName = $conf['mysql']["master_database"];
$inst->dbmaster->dbUser = $conf['mysql']["master_admin_user"];
$inst->dbmaster->dbPass = $conf['mysql']["master_admin_password"];
$inst->dbmaster->setDBData($conf['mysql']["master_host"], $conf['mysql']["master_admin_user"], $conf['mysql']["master_admin_password"]);
$inst->dbmaster->setDBName($conf['mysql']["master_database"]);
} else {
$inst->dbmaster = $inst->db;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment