mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Added generic memcached support to dbFacile.*
Remove now obsolete memcached code in: html/ajax_rulesuggest.php Remove all the broken memcached code in: html/pages/device/health/mempool.inc.php html/pages/device/overview/generic/sensor.inc.php html/pages/device/overview/mempools.inc.php html/pages/device/port.inc.php html/pages/device/ports.inc.php html/pages/health/sensors.inc.php includes/polling/functions.inc.php includes/polling/mempools.inc.php includes/polling/ports.inc.php includes/polling/storage.inc.php
This commit is contained in:
@@ -72,22 +72,16 @@ if (isset($_GET['term'],$_GET['device_id'])) {
|
||||
$_GET['device_id'] = mres($_GET['device_id']);
|
||||
if (strstr($_GET['term'], '.')) {
|
||||
$term = explode('.', $_GET['term']);
|
||||
if ($config['memcached']['enable']) {
|
||||
$chk = $memcache->get('rule-suggest_'.$term[0]);
|
||||
}
|
||||
|
||||
if (!(sizeof($chk) > 0) || $chk === false) {
|
||||
if ($term[0] == 'macros') {
|
||||
foreach ($config['alert']['macros']['rule'] as $macro => $v) {
|
||||
$chk[] = 'macros.'.$macro;
|
||||
}
|
||||
if ($term[0] == 'macros') {
|
||||
foreach ($config['alert']['macros']['rule'] as $macro => $v) {
|
||||
$chk[] = 'macros.'.$macro;
|
||||
}
|
||||
else {
|
||||
$tmp = dbFetchRows('SHOW COLUMNS FROM '.$term[0]);
|
||||
foreach ($tmp as $tst) {
|
||||
if (isset($tst['Field'])) {
|
||||
$chk[] = $term[0].'.'.$tst['Field'];
|
||||
}
|
||||
}
|
||||
else {
|
||||
$tmp = dbFetchRows('SHOW COLUMNS FROM '.$term[0]);
|
||||
foreach ($tmp as $tst) {
|
||||
if (isset($tst['Field'])) {
|
||||
$chk[] = $term[0].'.'.$tst['Field'];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -95,29 +89,18 @@ if (isset($_GET['term'],$_GET['device_id'])) {
|
||||
$current = true;
|
||||
}
|
||||
else {
|
||||
if ($config['memcached']['enable']) {
|
||||
$chk = $memcache->get('rule-suggest-toplvl');
|
||||
$tmp = dbFetchRows("SELECT TABLE_NAME FROM information_schema.COLUMNS WHERE COLUMN_NAME = 'device_id'");
|
||||
foreach ($tmp as $tst) {
|
||||
$chk[] = $tst['TABLE_NAME'].'.';
|
||||
}
|
||||
|
||||
if (!(sizeof($chk) > 0) || $chk === false) {
|
||||
$tmp = dbFetchRows("SELECT TABLE_NAME FROM information_schema.COLUMNS WHERE COLUMN_NAME = 'device_id'");
|
||||
foreach ($tmp as $tst) {
|
||||
$chk[] = $tst['TABLE_NAME'].'.';
|
||||
}
|
||||
|
||||
$chk[] = 'macros.';
|
||||
$chk[] = 'bills.';
|
||||
}
|
||||
$chk[] = 'macros.';
|
||||
$chk[] = 'bills.';
|
||||
}
|
||||
if (sizeof($chk) > 0) {
|
||||
if ($config['memcached']['enable']) {
|
||||
$memcache->set('rule-suggest-'.$oterm, $chk, 86400);
|
||||
// Cache for 24h
|
||||
}
|
||||
|
||||
$obj = levsort($_GET['term'], $chk);
|
||||
$obj = array_chunk($obj, 20, true);
|
||||
$obj = $obj[0];
|
||||
$obj = levsort($_GET['term'], $chk);
|
||||
$obj = array_chunk($obj, 20, true);
|
||||
$obj = $obj[0];
|
||||
$flds = array();
|
||||
if ($current === true) {
|
||||
foreach ($obj as $fld) {
|
||||
|
Reference in New Issue
Block a user