mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Use the persistent MySQL connections in install and build-base
Share mysql-connection from install to build-base
This commit is contained in:
@@ -13,8 +13,11 @@ if ($sql_fh === false) {
|
||||
echo 'ERROR: Cannot open SQL build script '.$sql_file."\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$database_link = mysqli_connect($config['db_host'], $config['db_user'], $config['db_pass']);
|
||||
if (is_resource($test_db)) {
|
||||
$database_link = &$test_db;
|
||||
} else {
|
||||
$database_link = mysqli_connect('p:'.$config['db_host'], $config['db_user'], $config['db_pass']);
|
||||
}
|
||||
if ($database_link === false) {
|
||||
echo 'ERROR: Cannot connect to database: '.mysqli_error($database_link)."\n";
|
||||
exit(1);
|
||||
|
||||
@@ -28,6 +28,7 @@ if($stage == "4" || $stage == "3") {
|
||||
}
|
||||
|
||||
require '../includes/defaults.inc.php';
|
||||
$config['db']['extension']='mysqli';
|
||||
// Work out the install directory
|
||||
$cur_dir = explode('/',__DIR__);
|
||||
$check = end($cur_dir);
|
||||
@@ -47,7 +48,7 @@ require 'includes/functions.inc.php';
|
||||
|
||||
// Check we can connect to MySQL DB, if not, back to stage 1 :)
|
||||
if($stage == 2) {
|
||||
$test_db = mysqli_connect($dbhost,$dbuser,$dbpass,$dbname);
|
||||
$test_db = mysqli_connect('p:'.$dbhost,$dbuser,$dbpass,$dbname);
|
||||
if(mysqli_connect_error()) {
|
||||
$stage = 1;
|
||||
$msg = "Couldn't connect to the database, please check your details<br /> " . mysqli_connect_error();
|
||||
|
||||
Reference in New Issue
Block a user