" . $name . " SQL server: " . mysqli_connect_error());
$con = null;
} else {
printalert("success", "Connected to the " . $name . " SQL server");
}
}
return $con;
}
function disconnect_database($con, $name) {
if ($con) {
mysqli_close($con);
printalert("info", "Disconnected from the " . $name . " SQL server");
}
}
function upgrade_service_databases($continue_r) {
$continue = $continue_r;
$con = null;
$con = connect_database($continue, "shard");
$continue = ($con != null);
if ($continue && get_db_version("shard") < 1) {
$continue = update_database_structure($continue, $con, "nel_00001.sql");
$continue = set_db_version($continue, "shard", 1);
}
if ($continue && get_db_version("shard") < 2) {
$continue = update_database_structure($continue, $con, "nel_00002.sql");
$continue = set_db_version($continue, "shard", 2);
}
disconnect_database($con, "shard");
$con = null;
$con = connect_database($continue, "tool");
$continue = ($con != null);
if ($continue && get_db_version("tool") < 1) {
$continue = update_database_structure($continue, $con, "nel_tool_00001.sql");
$continue = set_db_version($continue, "tool", 1);
}
disconnect_database($con, "tool");
return $continue;
}
function upgrade_support_databases($continue_r) {
$continue = $continue_r;
$con = null;
$con = connect_database($continue, "web");
$continue = ($con != null);
if ($continue && get_db_version("web") < 1) {
$continue = update_database_structure($continue, $con, "nel_ams_00001.sql");
$continue = set_db_version($continue, "web", 1);
}
disconnect_database($con, "web");
$con = null;
$con = connect_database($continue, "lib");
$continue = ($con != null);
if ($continue && get_db_version("lib") < 1) {
$continue = update_database_structure($continue, $con, "nel_ams_lib_00001.sql");
$continue = set_db_version($continue, "lib", 1);
}
if ($continue && get_db_version("lib") < 2) {
$continue = update_database_structure($continue, $con, "nel_ams_lib_00002.sql");
$continue = set_db_version($continue, "lib", 2);
}
disconnect_database($con, "lib");
return $continue;
}
function upgrade_domain_databases($continue_r) {
$continue = $continue_r;
$con = null;
$con = connect_database($continue, "ring");
$continue = ($con != null);
if ($continue && get_db_version("ring") < 1) {
$continue = update_database_structure($continue, $con, "ring_domain_00001.sql");
$continue = set_db_version($continue, "ring", 1);
}
disconnect_database($con, "ring");
return $continue;
}
?>