mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
feature: Add mysql failed query logging + fixed queries that break ONLY_FULL_GROUP_BY (#5327)
* feature: Add mysql failed query logging + fixed queries that break ONLY_FULL_GROUP_BY * fix all schema errors and update system
This commit is contained in:
committed by
Tony Murray
parent
8936d9503b
commit
da5783d917
@@ -53,7 +53,7 @@ if ($config['enable_pseudowires'] && $device['os_group'] == 'cisco') {
|
||||
// Cycle the list of pseudowires we cached earlier and make sure we saw them again.
|
||||
foreach ($device['pws_db'] as $pw_id => $pseudowire_id) {
|
||||
if (empty($device['pws'][$pw_id])) {
|
||||
dbDelete('vlans', '`pseudowire_id` = ?', array($pseudowire_id));
|
||||
dbDelete('pseudowires', '`pseudowire_id` = ?', array($pseudowire_id));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -713,7 +713,7 @@ function discover_process_ipv6(&$valid, $ifIndex, $ipv6_address, $ipv6_prefixlen
|
||||
echo 'N';
|
||||
} else {
|
||||
//Update Context
|
||||
dbUpdate(array('context_name' => $device['context_name']), 'ipv6_network', '`ipv6_network` = ?', array($ipv6_network));
|
||||
dbUpdate(array('context_name' => $device['context_name']), 'ipv6_networks', '`ipv6_network` = ?', array($ipv6_network));
|
||||
echo 'n';
|
||||
}
|
||||
|
||||
@@ -725,7 +725,7 @@ function discover_process_ipv6(&$valid, $ifIndex, $ipv6_address, $ipv6_prefixlen
|
||||
echo '+';
|
||||
} else {
|
||||
//Update Context
|
||||
dbUpdate(array('context_name' => $device['context_name']), 'ipv6_address', '`ipv6_address` = ? AND `ipv6_prefixlen` = ? AND `port_id` = ?', array($ipv6_address, $ipv6_prefixlen, $port_id));
|
||||
dbUpdate(array('context_name' => $device['context_name']), 'ipv6_addresses', '`ipv6_address` = ? AND `ipv6_prefixlen` = ? AND `port_id` = ?', array($ipv6_address, $ipv6_prefixlen, $port_id));
|
||||
echo '.';
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ foreach ($vrfs_lite_cisco as $vrf) {
|
||||
echo '+';
|
||||
} else {
|
||||
//Update Context
|
||||
dbUpdate(array('context_name' => $device['context_name']), 'ipv4_addresses', 'ipv4_address` = ? AND `ipv4_prefixlen` = ? AND `port_id` = ?', array($oid, $cidr, $port_id));
|
||||
dbUpdate(array('context_name' => $device['context_name']), 'ipv4_addresses', '`ipv4_address` = ? AND `ipv4_prefixlen` = ? AND `port_id` = ?', array($oid, $cidr, $port_id));
|
||||
echo '.';
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ foreach ($vrfs_lite_cisco as $vrf) {
|
||||
} //end foreach
|
||||
} //end if
|
||||
|
||||
$sql = "SELECT * FROM ipv6_addresses AS A, ports AS I WHERE I.device_id = '".$device['device_id']."' AND A.port_id = I.port_id'";
|
||||
$sql = "SELECT * FROM ipv6_addresses AS A, ports AS I WHERE I.device_id = '".$device['device_id']."' AND A.port_id = I.port_id";
|
||||
|
||||
foreach (dbFetchRows($sql) as $row) {
|
||||
$full_address = $row['ipv6_address'].'/'.$row['ipv6_prefixlen'];
|
||||
|
||||
@@ -78,8 +78,10 @@ foreach ($vlans_db as $domain_id => $vlans) {
|
||||
}
|
||||
|
||||
// remove non-existent port-vlan mappings
|
||||
$num = dbDelete('ports_vlans', '`device_id`=? AND `port_vlan_id` NOT IN ('.join(',', $valid_vlan_port).')', array($device['device_id']));
|
||||
d_echo("Deleted $num vlan mappings\n");
|
||||
if (is_array($valid_vlan_port) && count($valid_vlan_port) > 0) {
|
||||
$num = dbDelete('ports_vlans', '`device_id`=? AND `port_vlan_id` NOT IN ('.join(',', $valid_vlan_port).')', array($device['device_id']));
|
||||
d_echo("Deleted $num vlan mappings\n");
|
||||
}
|
||||
|
||||
unset($device['vlans']);
|
||||
unset($base_to_index, $tmp_base_indexes, $index_to_base, $per_vlan_data, $valid_vlan_port, $num);
|
||||
|
||||
Reference in New Issue
Block a user