" . $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); global $db_nel; for ($i = 1; $i <= $db_nel; $i++) { if ($continue && get_db_version("shard") < $i) { $continue = update_database_structure($continue, $con, "nel_" . str_pad($i, 5, "0", STR_PAD_LEFT) . ".sql"); $continue = set_db_version($continue, "shard", $i); } } disconnect_database($con, "shard"); $con = null; $con = connect_database($continue, "tool"); $continue = ($con != null); global $db_nel_tool; for ($i = 1; $i <= $db_nel_tool; $i++) { if ($continue && get_db_version("tool") < $i) { $continue = update_database_structure($continue, $con, "nel_tool_" . str_pad($i, 5, "0", STR_PAD_LEFT) . ".sql"); $continue = set_db_version($continue, "tool", $i); } } 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); global $db_nel_ams; for ($i = 1; $i <= $db_nel_ams; $i++) { if ($continue && get_db_version("web") < $i) { $continue = update_database_structure($continue, $con, "nel_ams_" . str_pad($i, 5, "0", STR_PAD_LEFT) . ".sql"); $continue = set_db_version($continue, "web", $i); } } disconnect_database($con, "web"); $con = null; $con = connect_database($continue, "lib"); $continue = ($con != null); global $db_nel_ams_lib; for ($i = 1; $i <= $db_nel_ams_lib; $i++) { if ($continue && get_db_version("lib") < $i) { $continue = update_database_structure($continue, $con, "nel_ams_lib_" . str_pad($i, 5, "0", STR_PAD_LEFT) . ".sql"); $continue = set_db_version($continue, "lib", $i); } } 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); global $db_ring_domain; for ($i = 1; $i <= $db_ring_domain; $i++) { if ($continue && get_db_version("ring") < $i) { $continue = update_database_structure($continue, $con, "ring_domain_" . str_pad($i, 5, "0", STR_PAD_LEFT) . ".sql"); $continue = set_db_version($continue, "ring", $i); } } disconnect_database($con, "ring"); return $continue; } function configure_shard_dev($continue_r) { $continue = $continue_r; $con = null; $con = connect_database($continue, "ring"); $continue = ($con != null); $continue = update_database_configure($continue, $con, "configure_shard_dev.sql"); disconnect_database($con, "ring"); return $continue; } ?>