mirror of
				https://github.com/librenms/librenms.git
				synced 2024-10-07 16:52:45 +00:00 
			
		
		
		
	Remove all unneeded if($debug)-statements and replace them with d_echo . html dir..
This commit is contained in:
		@@ -58,8 +58,5 @@ $end = utime();
 | 
			
		||||
$run = ($end - $start);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if ($debug) {
 | 
			
		||||
    echo '<br />Runtime '.$run.' secs';
 | 
			
		||||
 | 
			
		||||
    echo ('<br />MySQL: Cell    '.($db_stats['fetchcell'] + 0).'/'.round(($db_stats['fetchcell_sec'] + 0), 3).'s'.' Row    '.($db_stats['fetchrow'] + 0).'/'.round(($db_stats['fetchrow_sec'] + 0), 3).'s'.' Rows   '.($db_stats['fetchrows'] + 0).'/'.round(($db_stats['fetchrows_sec'] + 0), 3).'s'.' Column '.($db_stats['fetchcol'] + 0).'/'.round(($db_stats['fetchcol_sec'] + 0), 3).'s');
 | 
			
		||||
}
 | 
			
		||||
d_echo('<br />Runtime '.$run.' secs');
 | 
			
		||||
d_echo('<br />MySQL: Cell    '.($db_stats['fetchcell'] + 0).'/'.round(($db_stats['fetchcell_sec'] + 0), 3).'s'.' Row    '.($db_stats['fetchrow'] + 0).'/'.round(($db_stats['fetchrow_sec'] + 0), 3).'s'.' Rows   '.($db_stats['fetchrows'] + 0).'/'.round(($db_stats['fetchrows_sec'] + 0), 3).'s'.' Column '.($db_stats['fetchcol'] + 0).'/'.round(($db_stats['fetchcol_sec'] + 0), 3).'s');
 | 
			
		||||
 
 | 
			
		||||
@@ -69,9 +69,7 @@ function graph_error($string) {
 | 
			
		||||
 | 
			
		||||
    if ($height > '99') {
 | 
			
		||||
        shell_exec($rrd_cmd);
 | 
			
		||||
        if ($debug) {
 | 
			
		||||
            echo '<pre>'.$rrd_cmd.'</pre>';
 | 
			
		||||
        }
 | 
			
		||||
        d_echo('<pre>'.$rrd_cmd.'</pre>');
 | 
			
		||||
 | 
			
		||||
        if (is_file($graphfile) && !$debug) {
 | 
			
		||||
            header('Content-type: image/png');
 | 
			
		||||
@@ -135,9 +133,7 @@ else {
 | 
			
		||||
    else {
 | 
			
		||||
        if ($rrd_options) {
 | 
			
		||||
            rrdtool_graph($graphfile, $rrd_options);
 | 
			
		||||
            if ($debug) {
 | 
			
		||||
                echo $rrd_cmd;
 | 
			
		||||
            }
 | 
			
		||||
            d_echo($rrd_cmd);
 | 
			
		||||
 | 
			
		||||
            if (is_file($graphfile)) {
 | 
			
		||||
                if (!$debug) {
 | 
			
		||||
 
 | 
			
		||||
@@ -11,14 +11,10 @@ if (is_numeric($vars['id'])) {
 | 
			
		||||
 | 
			
		||||
    if (is_array($acc)) {
 | 
			
		||||
        if ($auth || port_permitted($acc['port_id'])) {
 | 
			
		||||
            if ($debug) {
 | 
			
		||||
                echo $config['rrd_dir'].'/'.$acc['hostname'].'/'.safename('cip-'.$acc['ifIndex'].'-'.$acc['mac'].'.rrd');
 | 
			
		||||
            }
 | 
			
		||||
            d_echo($config['rrd_dir'].'/'.$acc['hostname'].'/'.safename('cip-'.$acc['ifIndex'].'-'.$acc['mac'].'.rrd'));
 | 
			
		||||
 | 
			
		||||
            if (is_file($config['rrd_dir'].'/'.$acc['hostname'].'/'.safename('cip-'.$acc['ifIndex'].'-'.$acc['mac'].'.rrd'))) {
 | 
			
		||||
                if ($debug) {
 | 
			
		||||
                    echo 'exists';
 | 
			
		||||
                }
 | 
			
		||||
                d_echo('exists');
 | 
			
		||||
 | 
			
		||||
                $rrd_filename = $config['rrd_dir'].'/'.$acc['hostname'].'/'.safename('cip-'.$acc['ifIndex'].'-'.$acc['mac'].'.rrd');
 | 
			
		||||
                $port         = get_port_by_id($acc['port_id']);
 | 
			
		||||
 
 | 
			
		||||
@@ -18,9 +18,7 @@ foreach (dbFetchRows('SELECT * FROM `mempools` WHERE device_id = ?', array($devi
 | 
			
		||||
 | 
			
		||||
    if ($config['memcached']['enable'] === true) {
 | 
			
		||||
        $state = $memcache->get('mempool-'.$mempool['mempool_id'].'-state');
 | 
			
		||||
        if ($debug) {
 | 
			
		||||
            print_r($state);
 | 
			
		||||
        }
 | 
			
		||||
        d_echo($state);
 | 
			
		||||
 | 
			
		||||
        if (is_array($state)) {
 | 
			
		||||
            $mempool = array_merge($mempool, $state);
 | 
			
		||||
 
 | 
			
		||||
@@ -21,9 +21,7 @@ if (count($mempools)) {
 | 
			
		||||
    foreach ($mempools as $mempool) {
 | 
			
		||||
        if ($config['memcached']['enable'] === true) {
 | 
			
		||||
            $state = $memcache->get('mempool-'.$mempool['mempool_id'].'-state');
 | 
			
		||||
            if ($debug) {
 | 
			
		||||
                print_r($state);
 | 
			
		||||
            }
 | 
			
		||||
            d_echo($state);
 | 
			
		||||
 | 
			
		||||
            if (is_array($state)) {
 | 
			
		||||
                $mempool = array_merge($mempool, $state);
 | 
			
		||||
 
 | 
			
		||||
@@ -8,9 +8,7 @@ $port = dbFetchRow('SELECT * FROM `ports` WHERE `port_id` = ?', array($vars['por
 | 
			
		||||
 | 
			
		||||
if ($config['memcached']['enable'] === true) {
 | 
			
		||||
    $state = $memcache->get('port-'.$port['port_id'].'-state');
 | 
			
		||||
    if ($debug) {
 | 
			
		||||
        print_r($state);
 | 
			
		||||
    }
 | 
			
		||||
    d_echo($state);
 | 
			
		||||
 | 
			
		||||
    if (is_array($state)) {
 | 
			
		||||
        $port = array_merge($port, $state);
 | 
			
		||||
 
 | 
			
		||||
@@ -138,9 +138,7 @@ else {
 | 
			
		||||
    foreach ($ports as $port) {
 | 
			
		||||
        if ($config['memcached']['enable'] === true) {
 | 
			
		||||
            $state = $memcache->get('port-'.$port['port_id'].'-state');
 | 
			
		||||
            if ($debug) {
 | 
			
		||||
                print_r($state);
 | 
			
		||||
            }
 | 
			
		||||
            d_echo($state);
 | 
			
		||||
 | 
			
		||||
            if (is_array($state)) {
 | 
			
		||||
                $port = array_merge($port, $state);
 | 
			
		||||
 
 | 
			
		||||
@@ -24,9 +24,7 @@ echo '<tr class="tablehead">
 | 
			
		||||
foreach (dbFetchRows($sql, $param) as $sensor) {
 | 
			
		||||
    if ($config['memcached']['enable'] === true) {
 | 
			
		||||
        $sensor['sensor_current'] = $memcache->get('sensor-'.$sensor['sensor_id'].'-value');
 | 
			
		||||
        if ($debug) {
 | 
			
		||||
            echo 'Memcached['.'sensor-'.$sensor['sensor_id'].'-value'.'='.$sensor['sensor_current'].']';
 | 
			
		||||
        }
 | 
			
		||||
        d_echo('Memcached['.'sensor-'.$sensor['sensor_id'].'-value'.'='.$sensor['sensor_current'].']');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (empty($sensor['sensor_current'])) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user