Commit 8a8cc2bb authored by Jesse Norell's avatar Jesse Norell

fix some bugs in the switch to mysqli, Issue #3716

parent 277af431
...@@ -208,7 +208,7 @@ do { ...@@ -208,7 +208,7 @@ do {
} }
//* Initialize the MySQL server connection //* Initialize the MySQL server connection
if(@mysqli_connect($tmp_mysql_server_host . ':' . (int)$tmp_mysql_server_port, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) { if(@mysqli_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password, $tmp_mysql_server_database, (int)$tmp_mysql_server_port)) {
$conf['mysql']['host'] = $tmp_mysql_server_host; $conf['mysql']['host'] = $tmp_mysql_server_host;
$conf['mysql']['port'] = $tmp_mysql_server_port; $conf['mysql']['port'] = $tmp_mysql_server_port;
$conf['mysql']['admin_user'] = $tmp_mysql_server_admin_user; $conf['mysql']['admin_user'] = $tmp_mysql_server_admin_user;
...@@ -217,7 +217,7 @@ do { ...@@ -217,7 +217,7 @@ do {
$conf['mysql']['charset'] = $tmp_mysql_server_charset; $conf['mysql']['charset'] = $tmp_mysql_server_charset;
$finished = true; $finished = true;
} else { } else {
swriteln($inst->lng('Unable to connect to the specified MySQL server').' '.mysqli_error()); swriteln($inst->lng('Unable to connect to the specified MySQL server').' '.mysqli_connect_error());
} }
} while ($finished == false); } while ($finished == false);
unset($finished); unset($finished);
...@@ -553,7 +553,7 @@ if($install_mode == 'standard') { ...@@ -553,7 +553,7 @@ if($install_mode == 'standard') {
$tmp_mysql_server_database = $inst->free_query('MySQL master server database name', $conf['mysql']['master_database'],'mysql_master_database'); $tmp_mysql_server_database = $inst->free_query('MySQL master server database name', $conf['mysql']['master_database'],'mysql_master_database');
//* Initialize the MySQL server connection //* Initialize the MySQL server connection
if(@mysqli_connect($tmp_mysql_server_host . ':' . (int)$tmp_mysql_server_port, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) { if(@mysqli_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password, $tmp_mysql_server_database, (int)$tmp_mysql_server_port)) {
$conf['mysql']['master_host'] = $tmp_mysql_server_host; $conf['mysql']['master_host'] = $tmp_mysql_server_host;
$conf['mysql']['master_port'] = $tmp_mysql_server_port; $conf['mysql']['master_port'] = $tmp_mysql_server_port;
$conf['mysql']['master_admin_user'] = $tmp_mysql_server_admin_user; $conf['mysql']['master_admin_user'] = $tmp_mysql_server_admin_user;
...@@ -561,7 +561,7 @@ if($install_mode == 'standard') { ...@@ -561,7 +561,7 @@ if($install_mode == 'standard') {
$conf['mysql']['master_database'] = $tmp_mysql_server_database; $conf['mysql']['master_database'] = $tmp_mysql_server_database;
$finished = true; $finished = true;
} else { } else {
swriteln($inst->lng('Unable to connect to mysql server').' '.mysqli_error()); swriteln($inst->lng('Unable to connect to mysql server').' '.mysqli_connect_error());
} }
} while ($finished == false); } while ($finished == false);
unset($finished); unset($finished);
......
...@@ -229,7 +229,7 @@ do { ...@@ -229,7 +229,7 @@ do {
if(@mysqli_connect($conf["mysql"]["host"], $conf["mysql"]["admin_user"], $conf["mysql"]["admin_password"])) { if(@mysqli_connect($conf["mysql"]["host"], $conf["mysql"]["admin_user"], $conf["mysql"]["admin_password"])) {
$finished = true; $finished = true;
} else { } else {
swriteln($inst->lng('Unable to connect to mysql server').' '.mysqli_error()); swriteln($inst->lng('Unable to connect to mysql server').' '.mysqli_connect_error());
$conf["mysql"]["admin_password"] = $inst->free_query('MySQL root password', $conf['mysql']['admin_password'],'mysql_root_password'); $conf["mysql"]["admin_password"] = $inst->free_query('MySQL root password', $conf['mysql']['admin_password'],'mysql_root_password');
} }
} while ($finished == false); } while ($finished == false);
...@@ -255,7 +255,7 @@ if($conf['mysql']['master_slave_setup'] == 'y') { ...@@ -255,7 +255,7 @@ if($conf['mysql']['master_slave_setup'] == 'y') {
$tmp_mysql_server_database = $inst->free_query('MySQL master server database name', $conf['mysql']['master_database'],'mysql_master_database'); $tmp_mysql_server_database = $inst->free_query('MySQL master server database name', $conf['mysql']['master_database'],'mysql_master_database');
//* Initialize the MySQL server connection //* Initialize the MySQL server connection
if(@mysqli_connect($tmp_mysql_server_host . ':' . (int)$tmp_mysql_server_port, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) { if(@mysqli_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password, $tmp_mysql_server_database, (int)$tmp_mysql_server_port)) {
$conf['mysql']['master_host'] = $tmp_mysql_server_host; $conf['mysql']['master_host'] = $tmp_mysql_server_host;
$conf['mysql']['master_port'] = $tmp_mysql_server_port; $conf['mysql']['master_port'] = $tmp_mysql_server_port;
$conf['mysql']['master_admin_user'] = $tmp_mysql_server_admin_user; $conf['mysql']['master_admin_user'] = $tmp_mysql_server_admin_user;
...@@ -263,7 +263,7 @@ if($conf['mysql']['master_slave_setup'] == 'y') { ...@@ -263,7 +263,7 @@ if($conf['mysql']['master_slave_setup'] == 'y') {
$conf['mysql']['master_database'] = $tmp_mysql_server_database; $conf['mysql']['master_database'] = $tmp_mysql_server_database;
$finished = true; $finished = true;
} else { } else {
swriteln($inst->lng('Unable to connect to mysql server').' '.mysqli_error()); swriteln($inst->lng('Unable to connect to mysql server').' '.mysqli_connect_error());
} }
} while ($finished == false); } while ($finished == false);
unset($finished); unset($finished);
......
...@@ -558,7 +558,7 @@ class db extends mysqli ...@@ -558,7 +558,7 @@ class db extends mysqli
/* Connect to the database */ /* Connect to the database */
$link = mysqli_connect($clientdb_host, $clientdb_user, $clientdb_password); $link = mysqli_connect($clientdb_host, $clientdb_user, $clientdb_password);
if (!$link) { if (!$link) {
$app->log('Unable to connect to the database'.mysqli_error($link), LOGLEVEL_DEBUG); $app->log('Unable to connect to the database'.mysqli_connect_error(), LOGLEVEL_DEBUG);
return; return;
} }
/* Get database-size from information_schema */ /* Get database-size from information_schema */
......
...@@ -248,7 +248,7 @@ class software_update_plugin { ...@@ -248,7 +248,7 @@ class software_update_plugin {
//* Connect to the database //* Connect to the database
$link = mysqli_connect($clientdb_host, $clientdb_user, $clientdb_password); $link = mysqli_connect($clientdb_host, $clientdb_user, $clientdb_password);
if (!$link) { if (!$link) {
$app->log('Unable to connect to the database'.mysqli_error($link), LOGLEVEL_ERROR); $app->log('Unable to connect to the database'.mysqli_connect_error(), LOGLEVEL_ERROR);
return; return;
} }
......
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