1 | <?php |
||||
2 | |||||
3 | /* |
||||
4 | * LibreNMS |
||||
5 | * |
||||
6 | * Copyright (c) 2014 Neil Lathwood <https://github.com/laf/ http://www.lathwood.co.uk/fa> |
||||
7 | * |
||||
8 | * This program is free software: you can redistribute it and/or modify it |
||||
9 | * under the terms of the GNU General Public License as published by the |
||||
10 | * Free Software Foundation, either version 3 of the License, or (at your |
||||
11 | * option) any later version. Please see LICENSE.txt at the top level of |
||||
12 | * the source code distribution for details. |
||||
13 | */ |
||||
14 | use LibreNMS\Config; |
||||
0 ignored issues
–
show
|
|||||
15 | |||||
16 | $scale_min = '0'; |
||||
17 | |||||
18 | require 'includes/html/graphs/common.inc.php'; |
||||
19 | |||||
20 | $rrd_filename = Rrd::name($device['hostname'], 'poller-perf'); |
||||
0 ignored issues
–
show
The method
name() does not exist on App\Facades\Rrd . Since you implemented __callStatic , consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
21 | |||||
22 | $rrd_options .= ' DEF:poller=' . $rrd_filename . ':poller:AVERAGE'; |
||||
23 | $rrd_options .= " 'COMMENT:Seconds Cur Min Max Avg\\n'"; |
||||
24 | if (Config::get('applied_site_style') == 'dark') { |
||||
25 | $rrd_options .= ' LINE1.25:poller#63636d:Poller'; |
||||
26 | } else { |
||||
27 | $rrd_options .= ' LINE1.25:poller#36393d:Poller'; |
||||
28 | } |
||||
29 | $rrd_options .= ' GPRINT:poller:LAST:%6.2lf GPRINT:poller:MIN:%6.2lf'; |
||||
30 | $rrd_options .= " GPRINT:poller:MAX:%6.2lf 'GPRINT:poller:AVERAGE:%6.2lf\\n'"; |
||||
31 | |||||
32 | if ($_GET['previous'] == 'yes') { |
||||
33 | $rrd_options .= " COMMENT:' \\n'"; |
||||
34 | $rrd_options .= " DEF:pollerX=$rrd_filename:poller:AVERAGE:start=$prev_from:end=$from"; |
||||
35 | $rrd_options .= " SHIFT:pollerX:$period"; |
||||
36 | $rrd_options .= " LINE1.25:pollerX#CCCCCC:'Prev Poller'\t"; |
||||
37 | $rrd_options .= ' GPRINT:pollerX:MIN:%6.2lf'; |
||||
38 | $rrd_options .= " GPRINT:pollerX:MAX:%6.2lf 'GPRINT:pollerX:AVERAGE:%6.2lf\\n'"; |
||||
39 | } |
||||
40 |
Let?s assume that you have a directory layout like this:
and let?s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: