Merge pull request #1659 from laf/mysql-strict

Couple more mysql strict fixes
This commit is contained in:
Daniel Preussker
2015-08-13 12:33:29 +02:00
2 changed files with 4 additions and 3 deletions
+2 -2
View File
@@ -261,7 +261,7 @@ function RunRules($device) {
$extra = gzcompress(json_encode(array('contacts' => GetContacts($qry), 'rule'=>$qry)),9);
if( dbInsert(array('state' => 1, 'device_id' => $device, 'rule_id' => $rule['id'], 'details' => $extra),'alert_log') ) {
if( !dbUpdate(array('state' => 1, 'open' => 1),'alerts','device_id = ? && rule_id = ?', array($device,$rule['id'])) ) {
dbInsert(array('state' => 1, 'device_id' => $device, 'rule_id' => $rule['id'], 'open' => 1),'alerts');
dbInsert(array('state' => 1, 'device_id' => $device, 'rule_id' => $rule['id'], 'open' => 1,'alerted' => 0),'alerts');
}
echo " ALERT ";
}
@@ -274,7 +274,7 @@ function RunRules($device) {
else {
if( dbInsert(array('state' => 0, 'device_id' => $device, 'rule_id' => $rule['id']),'alert_log') ){
if( !dbUpdate(array('state' => 0, 'open' => 1),'alerts','device_id = ? && rule_id = ?', array($device,$rule['id'])) ) {
dbInsert(array('state' => 0, 'device_id' => $device, 'rule_id' => $rule['id'], 'open' => 1),'alerts');
dbInsert(array('state' => 0, 'device_id' => $device, 'rule_id' => $rule['id'], 'open' => 1, 'alerted' => 0),'alerts');
}
echo " OK ";
}
+2 -1
View File
@@ -583,7 +583,8 @@ function createHost($host, $community = NULL, $snmpver, $port = 161, $transport
'transport' => $transport,
'status' => '1',
'snmpver' => $snmpver,
'poller_group' => $poller_group
'poller_group' => $poller_group,
'status_reason' => '',
);
$device = array_merge($device, $v3);