Skip to content

Commit

Permalink
Don't connect to mysqli if no scanner DB
Browse files Browse the repository at this point in the history
  • Loading branch information
bbdoc committed Nov 3, 2023
1 parent ef2fc3d commit 33c339b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@
"Successfully Connected to Poracle DB":"Connecté à la DB Poracle",
"Unable to Connect to Scanner DB":"Impossible de se connecter à la DB du scanneur",
"Successfully Connected to Scanner DB":"Connecté à la DB du scanneur",
"Please configure Scanner DB":"Veuillez configurer la DB su scanneur",
"Unable to Connect to Poracle API":"Impossible de se connecter à l'API Poracle",
"Successfully Connected to Poracle API":"Connecté à l'API Poracle",
"To activate cache please perform following actions from your PoracleWeb root folder":"Pour l'activer, veuillez lancer les commandes suivantes depuis votre dossier principal",
Expand Down
15 changes: 10 additions & 5 deletions pages/display/server_settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,16 @@

// Check Connection to Scanner DB

$conn = new mysqli($scan_dbhost.":".$scan_dbport, $scan_dbuser, $scan_dbpass, $scan_dbname);
if ($conn->connect_errno) {
echo "<div class='alert alert-danger fade show' role='alert' style='padding: 3px; margin:3px;'>".i8ln("Unable to Connect to Scanner DB")."</div>";
} else {
echo "<div class='alert alert-success fade show' role='alert' style='padding: 3px; margin:3px;'>".i8ln("Successfully Connected to Scanner DB")."</div>";
if ( isset($scan_dbhost) ) {
$conn = new mysqli($scan_dbhost.":".$scan_dbport, $scan_dbuser, $scan_dbpass, $scan_dbname);
if ($conn->connect_errno) {
echo "<div class='alert alert-danger fade show' role='alert' style='padding: 3px; margin:3px;'>".i8ln("Unable to Connect to Scanner DB")."</div>";
} else {
echo "<div class='alert alert-success fade show' role='alert' style='padding: 3px; margin:3px;'>".i8ln("Successfully Connected to Scanner DB")."</div>";
}
} else
{
echo "<div class='alert alert-danger fade show' role='alert' style='padding: 3px; margin:3px;'>".i8ln("Please configure Scanner DB")."</div>";
}

// Check Connection to API
Expand Down

0 comments on commit 33c339b

Please sign in to comment.