mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Workaround for billing with large bps (#9044)
* Workaround for billing with large bps Workaround for mysqli driver mucking up BIGINT Real fix is for users to switch to mysqlnd * Add note * More bigints
This commit is contained in:
committed by
Neil Lathwood
parent
2e3aef6929
commit
29d51f4727
@@ -91,7 +91,8 @@ function CollectData($bill_id)
|
||||
$port_data['out_delta'] = '0';
|
||||
}
|
||||
|
||||
$fields = array('timestamp' => $now, 'in_counter' => set_numeric($port_data['in_measurement']), 'out_counter' => set_numeric($port_data['out_measurement']), 'in_delta' => set_numeric($port_data['in_delta']), 'out_delta' => set_numeric($port_data['out_delta']));
|
||||
// NOTE: casting to string for mysqli bug (fixed by mysqlnd)
|
||||
$fields = array('timestamp' => $now, 'in_counter' => (string)set_numeric($port_data['in_measurement']), 'out_counter' => (string)set_numeric($port_data['out_measurement']), 'in_delta' => (string)set_numeric($port_data['in_delta']), 'out_delta' => (string)set_numeric($port_data['out_delta']));
|
||||
if (dbUpdate($fields, 'bill_port_counters', "`port_id`='" . mres($port_id) . "' AND `bill_id`='$bill_id'") == 0) {
|
||||
$fields['bill_id'] = $bill_id;
|
||||
$fields['port_id'] = $port_id;
|
||||
@@ -127,7 +128,8 @@ function CollectData($bill_id)
|
||||
if (!empty($period) && $period < '0') {
|
||||
logfile("BILLING: negative period! id:$bill_id period:$period delta:$delta in_delta:$in_delta out_delta:$out_delta");
|
||||
} else {
|
||||
dbInsert(array('bill_id' => $bill_id, 'timestamp' => $now, 'period' => $period, 'delta' => $delta, 'in_delta' => $in_delta, 'out_delta' => $out_delta), 'bill_data');
|
||||
// NOTE: casting to string for mysqli bug (fixed by mysqlnd)
|
||||
dbInsert(array('bill_id' => $bill_id, 'timestamp' => $now, 'period' => $period, 'delta' => (string)$delta, 'in_delta' => (string)$in_delta, 'out_delta' => (string)$out_delta), 'bill_data');
|
||||
}
|
||||
}//end CollectData()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user