mirror of
https://github.com/rsyslog/loganalyzer.git
synced 2025-09-25 18:59:12 +02:00
Fix getting uninitialized default config value
- catch SQL errors in LoadConfig - incremented DB Version to 14
This commit is contained in:
parent
059334ca85
commit
18c40e1af5
@ -1908,7 +1908,7 @@ function GetConfigSetting($szSettingName, $szDefaultValue = "", $DesiredConfigLe
|
|||||||
if ( isset($CFG[$szSettingName]) )
|
if ( isset($CFG[$szSettingName]) )
|
||||||
return $CFG[$szSettingName];
|
return $CFG[$szSettingName];
|
||||||
else
|
else
|
||||||
return $szDefaultValue;
|
return (isset($szDefaultValue) ? $szDefaultValue : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -949,30 +949,37 @@ function LoadChartsFromDatabase()
|
|||||||
// ---
|
// ---
|
||||||
|
|
||||||
// Get Searches from DB now!
|
// Get Searches from DB now!
|
||||||
$result = DB_Query($sqlquery);
|
try {
|
||||||
$myrows = DB_GetAllRows($result, true);
|
$result = DB_Query($sqlquery);
|
||||||
if ( isset($myrows ) && count($myrows) > 0 )
|
$myrows = DB_GetAllRows($result, true);
|
||||||
{
|
if ( isset($myrows ) && count($myrows) > 0 )
|
||||||
// Overwrite the existing graphics matrix but only the records of
|
|
||||||
// the database, those of the configuration file we keep.
|
|
||||||
$not_remove = array();
|
|
||||||
foreach($CFG['Charts'] as $chartid => $myChart)
|
|
||||||
{
|
{
|
||||||
if (! is_numeric($chartid) ) {
|
// Overwrite the existing graphics matrix but only the records of
|
||||||
$not_remove[$chartid] = $myChart;
|
// the database, those of the configuration file we keep.
|
||||||
|
$not_remove = array();
|
||||||
|
foreach($CFG['Charts'] as $chartid => $myChart)
|
||||||
|
{
|
||||||
|
if (! is_numeric($chartid) ) {
|
||||||
|
$not_remove[$chartid] = $myChart;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
$CFG['Charts'] = $not_remove;
|
||||||
|
|
||||||
|
// Loop through all data rows
|
||||||
|
foreach ($myrows as &$myChart )
|
||||||
|
{
|
||||||
|
// Append to Chart Array
|
||||||
|
$CFG['Charts'][ $myChart['ID'] ] = $myChart;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy to content array!
|
||||||
|
$content['Charts'] = $CFG['Charts'];
|
||||||
}
|
}
|
||||||
$CFG['Charts'] = $not_remove;
|
} catch (mysqli_sql_exception $e) {
|
||||||
|
// DEBUG ERROR
|
||||||
// Loop through all data rows
|
OutputDebugMessage("LoadChartsFromDatabase: DB Query failed with Code " . $e->getCode() . ": " . $e->getMessage(), DEBUG_ERROR);
|
||||||
foreach ($myrows as &$myChart )
|
|
||||||
{
|
|
||||||
// Append to Chart Array
|
|
||||||
$CFG['Charts'][ $myChart['ID'] ] = $myChart;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Copy to content array!
|
// Copy to content array!
|
||||||
$content['Charts'] = $CFG['Charts'];
|
$content['Charts'] = array();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ $errdesc = "";
|
|||||||
$errno = 0;
|
$errno = 0;
|
||||||
|
|
||||||
// --- Current Database Version, this is important for automated database Updates!
|
// --- 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
|
$content['database_installedversion'] = "0"; // 0 is default which means Prior Versioning Database
|
||||||
// ---
|
// ---
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user