Remove debug globals (#12811)

* Remove $debug global
and $vdebug global
makes these variables more accessible and protects from collisions.

* the on boot set sends application as the first parameter, just handle that

* Relocate other debug related functions

* Log debug to stdout

* Wrong output

* remove stupid constants

* Fix lint and style issues
This commit is contained in:
Tony Murray
2021-04-29 22:42:18 -05:00
committed by GitHub
parent 2cdd762656
commit 61c89794e4
51 changed files with 287 additions and 278 deletions

View File

@@ -18,6 +18,7 @@
use App\Models\Device;
use Illuminate\Support\Str;
use LibreNMS\Config;
use LibreNMS\Util\Debug;
use Symfony\Component\Process\Exception\ProcessTimedOutException;
function string_to_oid($string)
@@ -707,8 +708,6 @@ function snmpwalk_cache_twopart_oid($device, $oid, $array, $mib = 0, $mibdir = n
function snmpwalk_cache_threepart_oid($device, $oid, $array, $mib = 0)
{
global $debug;
$cmd = gen_snmpwalk_cmd($device, $oid, '-OQUs', $mib);
$data = trim(external_exec($cmd));
@@ -719,7 +718,7 @@ function snmpwalk_cache_threepart_oid($device, $oid, $array, $mib = 0)
$value = str_replace('"', '', $value);
[$oid, $first, $second, $third] = explode('.', $oid);
if ($debug) {
if (Debug::isEnabled()) {
echo "$entry || $oid || $first || $second || $third\n";
}