Skip to content

Commit 6f7d056

Browse files
murrantStyleCIBotlaf
authored
Application Graph fixes (librenms#17831)
* Application Graph fixes * Apply fixes from StyleCI * Updated more application graph files * Apply fixes from StyleCI * Eradicate $filename (mostly) * Fix up find replace errors * Apply fixes from StyleCI --------- Co-authored-by: StyleCI Bot <bot@styleci.io> Co-authored-by: Neil Lathwood <gh+n@laf.io>
1 parent baef426 commit 6f7d056

File tree

982 files changed

+4562
-8119
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

982 files changed

+4562
-8119
lines changed

includes/html/graphs/application/apache_bits.inc.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@
44

55
require 'includes/html/graphs/common.inc.php';
66

7-
$apache_rrd = Rrd::name($device['hostname'], ['app', 'apache', $app->app_id]);
8-
9-
if (Rrd::checkRrdExists($apache_rrd)) {
10-
$rrd_filename = $apache_rrd;
11-
}
7+
$rrd_filename = Rrd::name($device['hostname'], ['app', 'apache', $app->app_id]);
128

139
$ds = 'kbyte';
1410

includes/html/graphs/application/apache_cpu.inc.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@
44

55
require 'includes/html/graphs/common.inc.php';
66

7-
$apache_rrd = Rrd::name($device['hostname'], ['app', 'apache', $app->app_id]);
8-
9-
if (Rrd::checkRrdExists($apache_rrd)) {
10-
$rrd_filename = $apache_rrd;
11-
}
7+
$rrd_filename = Rrd::name($device['hostname'], ['app', 'apache', $app->app_id]);
128

139
$ds = 'cpu';
1410

includes/html/graphs/application/apache_hits.inc.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@
44

55
require 'includes/html/graphs/common.inc.php';
66

7-
$apache_rrd = Rrd::name($device['hostname'], ['app', 'apache', $app->app_id]);
8-
9-
if (Rrd::checkRrdExists($apache_rrd)) {
10-
$rrd_filename = $apache_rrd;
11-
}
7+
$rrd_filename = Rrd::name($device['hostname'], ['app', 'apache', $app->app_id]);
128

139
$ds = 'access';
1410

includes/html/graphs/application/apache_scoreboard.inc.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,12 @@
5050
];
5151

5252
$i = 0;
53-
if (Rrd::checkRrdExists($rrd_filename)) {
54-
foreach ($array as $ds => $var) {
55-
$rrd_list[$i]['filename'] = $rrd_filename;
56-
$rrd_list[$i]['descr'] = $var['descr'];
57-
$rrd_list[$i]['ds'] = $ds;
58-
$rrd_list[$i]['colour'] = $var['colour'];
59-
$i++;
60-
}
61-
} else {
62-
echo "file missing: $file";
53+
foreach ($array as $ds => $var) {
54+
$rrd_list[$i]['filename'] = $rrd_filename;
55+
$rrd_list[$i]['descr'] = $var['descr'];
56+
$rrd_list[$i]['ds'] = $ds;
57+
$rrd_list[$i]['colour'] = $var['colour'];
58+
$i++;
6359
}
6460

6561
$colours = 'mixed';

includes/html/graphs/application/asterisk_iax2.inc.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,11 @@
1717
$colours = 'mixed';
1818
$rrd_list = [];
1919

20-
if (Rrd::checkRrdExists($rrd_filename)) {
21-
foreach ($astiax2_access_array as $ds => $descr) {
22-
$rrd_list[$i]['filename'] = $rrd_filename;
23-
$rrd_list[$i]['descr'] = $descr;
24-
$rrd_list[$i]['ds'] = $ds;
25-
$i++;
26-
}
27-
} else {
28-
echo "file missing: $rrd_filename";
20+
foreach ($astiax2_access_array as $ds => $descr) {
21+
$rrd_list[$i]['filename'] = $rrd_filename;
22+
$rrd_list[$i]['descr'] = $descr;
23+
$rrd_list[$i]['ds'] = $ds;
24+
$i++;
2925
}
26+
3027
require 'includes/html/graphs/generic_multi_line.inc.php';

includes/html/graphs/application/asterisk_sip.inc.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,11 @@
1919
$colours = 'mixed';
2020
$rrd_list = [];
2121

22-
if (Rrd::checkRrdExists($rrd_filename)) {
23-
foreach ($astsip_access_array as $ds => $descr) {
24-
$rrd_list[$i]['filename'] = $rrd_filename;
25-
$rrd_list[$i]['descr'] = $descr;
26-
$rrd_list[$i]['ds'] = $ds;
27-
$i++;
28-
}
29-
} else {
30-
echo "file missing: $rrd_filename";
22+
foreach ($astsip_access_array as $ds => $descr) {
23+
$rrd_list[$i]['filename'] = $rrd_filename;
24+
$rrd_list[$i]['descr'] = $descr;
25+
$rrd_list[$i]['ds'] = $ds;
26+
$i++;
3127
}
28+
3229
require 'includes/html/graphs/generic_multi_line.inc.php';

includes/html/graphs/application/auth.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
use App\Models\Application;
44

5-
if (is_numeric($vars['id'])) {
5+
if (isset($vars['id']) && is_numeric($vars['id'])) {
66
// check user has access, unless allow_unauth_graphs is enabled
77
$app = Application::when(! $auth, function ($query) {
88
return $query->hasAccess(Auth::user());

includes/html/graphs/application/backupninja_backupninja.inc.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,12 @@
2424
];
2525

2626
$i = 0;
27-
if (Rrd::checkRrdExists($rrd_filename)) {
28-
foreach ($array as $ds => $var) {
29-
$rrd_list[$i]['filename'] = $rrd_filename;
30-
$rrd_list[$i]['descr'] = $var['descr'];
31-
$rrd_list[$i]['ds'] = $ds;
32-
// $rrd_list[$i]['colour'] = $var['colour'];
33-
$i++;
34-
}
35-
} else {
36-
echo "file missing: $file";
27+
foreach ($array as $ds => $var) {
28+
$rrd_list[$i]['filename'] = $rrd_filename;
29+
$rrd_list[$i]['descr'] = $var['descr'];
30+
$rrd_list[$i]['ds'] = $ds;
31+
// $rrd_list[$i]['colour'] = $var['colour'];
32+
$i++;
3733
}
3834

3935
$colours = 'mixed';

includes/html/graphs/application/bind_adb_in.inc.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,17 @@
1010

1111
$rrd_filename = Rrd::name($device['hostname'], ['app', 'bind', $app->app_id, 'adb']);
1212

13-
$rrd_list = [];
14-
if (Rrd::checkRrdExists($rrd_filename)) {
15-
$rrd_list[] = [
13+
$rrd_list = [
14+
[
1615
'filename' => $rrd_filename,
1716
'descr' => 'Addresses',
1817
'ds' => 'aiht',
19-
];
20-
$rrd_list[] = [
18+
],
19+
[
2120
'filename' => $rrd_filename,
2221
'descr' => 'Names',
2322
'ds' => 'niht',
24-
];
25-
} else {
26-
d_echo('RRD "' . $rrd_filename . '" not found');
27-
}
23+
],
24+
];
2825

2926
require 'includes/html/graphs/generic_multi_line.inc.php';

includes/html/graphs/application/bind_adb_size.inc.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,17 @@
1010

1111
$rrd_filename = Rrd::name($device['hostname'], ['app', 'bind', $app->app_id, 'adb']);
1212

13-
$rrd_list = [];
14-
if (Rrd::checkRrdExists($rrd_filename)) {
15-
$rrd_list[] = [
13+
$rrd_list = [
14+
[
1615
'filename' => $rrd_filename,
1716
'descr' => 'Address',
1817
'ds' => 'ahts',
19-
];
20-
$rrd_list[] = [
18+
],
19+
[
2120
'filename' => $rrd_filename,
2221
'descr' => 'Name',
2322
'ds' => 'nhts',
24-
];
25-
} else {
26-
d_echo('RRD "' . $rrd_filename . '" not found');
27-
}
23+
],
24+
];
2825

2926
require 'includes/html/graphs/generic_multi_line.inc.php';

0 commit comments

Comments
 (0)