Fix getting uninitialized default config value

- catch SQL errors in LoadConfig
- incremented DB Version to 14
This commit is contained in:
Andre Lorbach 2023-02-07 10:46:36 +01:00
parent 059334ca85
commit 18c40e1af5
3 changed files with 29 additions and 22 deletions

View File

@ -1908,7 +1908,7 @@ function GetConfigSetting($szSettingName, $szDefaultValue = "", $DesiredConfigLe
if ( isset($CFG[$szSettingName]) )
return $CFG[$szSettingName];
else
return $szDefaultValue;
return (isset($szDefaultValue) ? $szDefaultValue : "");
}
/*

View File

@ -949,6 +949,7 @@ function LoadChartsFromDatabase()
// ---
// Get Searches from DB now!
try {
$result = DB_Query($sqlquery);
$myrows = DB_GetAllRows($result, true);
if ( isset($myrows ) && count($myrows) > 0 )
@ -974,6 +975,12 @@ function LoadChartsFromDatabase()
// Copy to content array!
$content['Charts'] = $CFG['Charts'];
}
} catch (mysqli_sql_exception $e) {
// DEBUG ERROR
OutputDebugMessage("LoadChartsFromDatabase: DB Query failed with Code " . $e->getCode() . ": " . $e->getMessage(), DEBUG_ERROR);
// Copy to content array!
$content['Charts'] = array();
}
}

View File

@ -49,7 +49,7 @@ $errdesc = "";
$errno = 0;
// --- Current Database Version, this is important for automated database Updates!
$content['database_internalversion'] = "13"; // Whenever incremented, a database upgrade is needed
$content['database_internalversion'] = "14"; // Whenever incremented, a database upgrade is needed
$content['database_installedversion'] = "0"; // 0 is default which means Prior Versioning Database
// ---