Issues (2963)

includes/polling/storage/datadomain.inc.php (1 issue)

Labels
Severity
1
<?php
2
/*
3
 * This program is free software: you can redistribute it and/or modify it
4
 * under the terms of the GNU General Public License as published by the
5
 * Free Software Foundation, either version 3 of the License, or (at your
6
 * option) any later version.  Please see LICENSE.txt at the top level of
7
 * the source code distribution for details.
8
9
 * @package    LibreNMS
10
 * @link       https://www.librenms.org
11
 * @copyright  2018 ACL
12
 * @author     Abel Laura <[email protected]>
13
*/
14
15
if (! is_array($storage_cache['ddos-storage'])) {
16
    $storage_cache['ddos-storage'] = snmpwalk_cache_oid($device, 'fileSystemSpaceTable', null, 'DATA-DOMAIN-MIB', 'datadomain');
0 ignored issues
show
Are you sure the assignment to $storage_cache['ddos-storage'] is correct as snmpwalk_cache_oid($devi...AIN-MIB', 'datadomain') seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
17
    d_echo($storage_cache);
18
}
19
20
foreach ($storage_cache['ddos-storage'] as $fsentry) {
21
    if ($fsentry['fileSystemResourceName'] == '/data: post-comp') {
22
        $storage['units'] = 1073741824;
23
        $storage['size'] = $fsentry['fileSystemSpaceSize'] * $storage['units'];
24
        $storage['free'] = $fsentry['fileSystemSpaceAvail'] * $storage['units'];
25
        $storage['used'] = $fsentry['fileSystemSpaceUsed'] * $storage['units'];
26
    }
27
}
28