mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
more code cleanup
git-svn-id: http://www.observium.org/svn/observer/trunk@2517 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -23,6 +23,7 @@ Usage
|
||||
* */
|
||||
function dbQuery($sql, $parameters = array()) {
|
||||
global $fullSql, $debug;
|
||||
|
||||
$fullSql = dbMakeQuery($sql, $parameters);
|
||||
if ($debug) { echo(" SQL[".$fullSql."] "); }
|
||||
/*
|
||||
@@ -53,7 +54,9 @@ function dbQuery($sql, $parameters = array()) {
|
||||
* */
|
||||
function dbInsert($data, $table) {
|
||||
global $fullSql;
|
||||
|
||||
global $db_stats;
|
||||
|
||||
// the following block swaps the parameters if they were given in the wrong order.
|
||||
// it allows the method to work for those that would rather it (or expect it to)
|
||||
// follow closer with SQL convention:
|
||||
@@ -98,7 +101,9 @@ function dbInsert($data, $table) {
|
||||
* */
|
||||
function dbUpdate($data, $table, $where = null, $parameters = array()) {
|
||||
global $fullSql;
|
||||
|
||||
global $db_stats;
|
||||
|
||||
// the following block swaps the parameters if they were given in the wrong order.
|
||||
// it allows the method to work for those that would rather it (or expect it to)
|
||||
// follow closer with SQL convention:
|
||||
@@ -228,6 +233,7 @@ function dbFetchRow($sql = null, $parameters = array()) {
|
||||
* */
|
||||
function dbFetchCell($sql, $parameters = array()) {
|
||||
global $db_stats;
|
||||
|
||||
$time_start = microtime(true);
|
||||
$row = dbFetchRow($sql, $parameters);
|
||||
if($row) {
|
||||
@@ -247,6 +253,7 @@ function dbFetchCell($sql, $parameters = array()) {
|
||||
* */
|
||||
function dbFetchColumn($sql, $parameters = array()) {
|
||||
global $db_stats;
|
||||
|
||||
$time_start = microtime(true);
|
||||
$cells = array();
|
||||
foreach(dbFetch($sql, $parameters) as $row) {
|
||||
|
@@ -325,6 +325,7 @@ function isSNMPable($device)
|
||||
function isPingable($hostname)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$status = shell_exec($config['fping'] . " $hostname 2>/dev/null");
|
||||
if (strstr($status, "alive"))
|
||||
{
|
||||
@@ -348,6 +349,7 @@ function is_odd($number)
|
||||
function isValidInterface($if)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$if = strtolower($if);
|
||||
$nullintf = 0;
|
||||
foreach ($config['bad_if'] as $bi)
|
||||
|
@@ -4,6 +4,7 @@
|
||||
|
||||
function callsgraphSNOM ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) {
|
||||
global $config;
|
||||
|
||||
$database = $config['rrd_dir'] . "/" . $rrd;
|
||||
$imgfile = "graphs/" . "$graph";
|
||||
$optsa = array( "--start", $from, "--end", $to, "--width", $width, "--height", $height, "--vertical-label", $vertical ,"--alt-autoscale-max",
|
||||
|
@@ -8,6 +8,7 @@
|
||||
|
||||
function get_cache($host, $value){
|
||||
global $dev_cache;
|
||||
|
||||
if (!isset($dev_cache[$host][$value])){
|
||||
switch($value){
|
||||
case 'device_id':
|
||||
@@ -34,6 +35,7 @@ function get_cache($host, $value){
|
||||
|
||||
function process_syslog ($entry, $update) {
|
||||
global $config;
|
||||
|
||||
global $dev_cache;
|
||||
|
||||
foreach($config['syslog_filter'] as $bi)
|
||||
|
Reference in New Issue
Block a user