Skip to content

Commit 2fc3a21

Browse files
authored
Apply fixes from StyleCI (librenms#12121)
1 parent 82f43cb commit 2fc3a21

File tree

338 files changed

+2899
-2973
lines changed

Some content is hidden

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

338 files changed

+2899
-2973
lines changed

includes/html/pages/bill.inc.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ function print_port_list($ports)
8383
}
8484

8585
echo '</div></div>';
86-
}//end print_port_list ?>
86+
}//end print_port_list?>
8787

8888
<h2><?php echo "Bill: ${bill_data['bill_name']}"; ?></h2>
8989

@@ -197,7 +197,7 @@ function print_port_list($ports)
197197
</td>
198198

199199
<?php
200-
}//end if ?>
200+
}//end if?>
201201
</tr>
202202
</table>
203203
</div>

includes/html/pages/plugin/admin.inc.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
</script>
3131
';
3232
}
33-
}//end if ?>
33+
}//end if?>
3434

3535
<div class="panel panel-default panel-condensed">
3636
<div class="panel-heading">

includes/polling/applications.inc.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<?php
22

3-
$app_rows = dbFetchRows('SELECT * FROM `applications` WHERE `device_id` = ?', array($device['device_id']));
3+
$app_rows = dbFetchRows('SELECT * FROM `applications` WHERE `device_id` = ?', [$device['device_id']]);
44

55
if (count($app_rows) > 0) {
66
foreach ($app_rows as $app) {
77
$app_include = \LibreNMS\Config::get('install_dir') . '/includes/polling/applications/' . $app['app_type'] . '.inc.php';
88
if (is_file($app_include)) {
99
include $app_include;
1010
} else {
11-
echo $app['app_type'].' include missing! ';
11+
echo $app['app_type'] . ' include missing! ';
1212
}
1313
}
1414
echo "\n";

includes/polling/applications/apache.inc.php

+28-28
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@
55

66
$name = 'apache';
77
$app_id = $app['app_id'];
8-
if (!empty($agent_data['app'][$name])) {
8+
if (! empty($agent_data['app'][$name])) {
99
$apache = $agent_data['app'][$name];
1010
} else {
1111
$options = '-Oqv';
12-
$oid = '.1.3.6.1.4.1.8072.1.3.2.3.1.2.6.97.112.97.99.104.101';
13-
$apache = snmp_get($device, $oid, $options);
12+
$oid = '.1.3.6.1.4.1.8072.1.3.2.3.1.2.6.97.112.97.99.104.101';
13+
$apache = snmp_get($device, $oid, $options);
1414
}
1515

1616
echo ' apache';
1717

18-
list ($total_access, $total_kbyte, $cpuload, $uptime, $reqpersec, $bytespersec,
18+
[$total_access, $total_kbyte, $cpuload, $uptime, $reqpersec, $bytespersec,
1919
$bytesperreq, $busyworkers, $idleworkers, $score_wait, $score_start,
2020
$score_reading, $score_writing, $score_keepalive, $score_dns,
21-
$score_closing, $score_logging, $score_graceful, $score_idle, $score_open) = explode("\n", $apache);
21+
$score_closing, $score_logging, $score_graceful, $score_idle, $score_open] = explode("\n", $apache);
2222

23-
$rrd_name = array('app', $name, $app_id);
23+
$rrd_name = ['app', $name, $app_id];
2424
$rrd_def = RrdDefinition::make()
2525
->addDataset('access', 'DERIVE', 0, 125000000000)
2626
->addDataset('kbyte', 'DERIVE', 0, 125000000000)
@@ -43,28 +43,28 @@
4343
->addDataset('sb_idle', 'GAUGE', 0, 125000000000)
4444
->addDataset('sb_open', 'GAUGE', 0, 125000000000);
4545

46-
$fields = array(
47-
'access' => intval(trim($total_access, '"')),
48-
'kbyte' => $total_kbyte,
49-
'cpu' => $cpuload,
50-
'uptime' => $uptime,
51-
'reqpersec' => $reqpersec,
52-
'bytespersec' => $bytespersec,
53-
'byesperreq' => $bytesperreq,
54-
'busyworkers' => $busyworkers,
55-
'idleworkers' => $idleworkers,
56-
'sb_wait' => $score_wait,
57-
'sb_start' => $score_start,
58-
'sb_reading' => $score_reading,
59-
'sb_writing' => $score_writing,
60-
'sb_keepalive' => $score_keepalive,
61-
'sb_dns' => $score_dns,
62-
'sb_closing' => $score_closing,
63-
'sb_logging' => $score_logging,
64-
'sb_graceful' => $score_graceful,
65-
'sb_idle' => $score_idle,
66-
'sb_open' => intval(trim($score_open, '"')),
67-
);
46+
$fields = [
47+
'access' => intval(trim($total_access, '"')),
48+
'kbyte' => $total_kbyte,
49+
'cpu' => $cpuload,
50+
'uptime' => $uptime,
51+
'reqpersec' => $reqpersec,
52+
'bytespersec' => $bytespersec,
53+
'byesperreq' => $bytesperreq,
54+
'busyworkers' => $busyworkers,
55+
'idleworkers' => $idleworkers,
56+
'sb_wait' => $score_wait,
57+
'sb_start' => $score_start,
58+
'sb_reading' => $score_reading,
59+
'sb_writing' => $score_writing,
60+
'sb_keepalive' => $score_keepalive,
61+
'sb_dns' => $score_dns,
62+
'sb_closing' => $score_closing,
63+
'sb_logging' => $score_logging,
64+
'sb_graceful' => $score_graceful,
65+
'sb_idle' => $score_idle,
66+
'sb_open' => intval(trim($score_open, '"')),
67+
];
6868

6969
$tags = compact('name', 'app_id', 'rrd_name', 'rrd_def');
7070
data_update($device, 'app', $tags, $fields);

includes/polling/applications/asterisk.inc.php

+16-16
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,27 @@
77

88
echo "$name, app_id=$app_id ";
99

10-
if (!empty($agent_data[$name])) {
10+
if (! empty($agent_data[$name])) {
1111
$rawdata = $agent_data[$name];
1212
} else {
1313
$options = '-Oqv';
1414
$oid = '.1.3.6.1.4.1.8072.1.3.2.4.1.2.8.97.115.116.101.114.105.115.107';
1515
$rawdata = snmp_walk($device, $oid, $options);
16-
$rawdata = str_replace("<<<asterisk>>>\n", '', $rawdata);
16+
$rawdata = str_replace("<<<asterisk>>>\n", '', $rawdata);
1717
}
1818

19-
# Format Data
19+
// Format Data
2020
$lines = explode("\n", $rawdata);
21-
$asterisk = array();
22-
$asterisk_metrics = array();
21+
$asterisk = [];
22+
$asterisk_metrics = [];
2323
foreach ($lines as $line) {
24-
list($var,$value) = explode('=', $line);
24+
[$var,$value] = explode('=', $line);
2525
$asterisk[$var] = $value;
2626
}
2727
unset($lines);
2828

29-
# Asterisk stats
30-
$rrd_name = array('app', $name, 'stats', $app_id);
29+
// Asterisk stats
30+
$rrd_name = ['app', $name, 'stats', $app_id];
3131
$rrd_def = RrdDefinition::make()
3232
->addDataset('calls', 'GAUGE', 0, 10000)
3333
->addDataset('channels', 'GAUGE', 0, 20000)
@@ -37,36 +37,36 @@
3737
->addDataset('sipunmononline', 'GAUGE', 0, 10000)
3838
->addDataset('sipunmonoffline', 'GAUGE', 0, 10000);
3939

40-
$sip_fields = array(
40+
$sip_fields = [
4141
'calls' => $asterisk['Calls'],
4242
'channels' => $asterisk['Channels'],
4343
'sippeers' => $asterisk['SipPeers'],
4444
'sipmononline' => $asterisk['SipMonOnline'],
4545
'sipmonoffline' => $asterisk['SipMonOffline'],
4646
'sipunmononline' => $asterisk['SipUnMonOnline'],
47-
'sipunmonoffline' => $asterisk['SipUnMonOffline']
48-
);
47+
'sipunmonoffline' => $asterisk['SipUnMonOffline'],
48+
];
4949

5050
$asterisk_metrics['stats'] = $sip_fields;
5151
$sip_tags = compact('name', 'app_id', 'rrd_name', 'rrd_def');
5252
data_update($device, 'app', $sip_tags, $sip_fields);
5353

5454
unset($rrd_name, $rrd_def, $sip_fields, $sip_tags);
5555

56-
# Additional iax2 stats
57-
$rrd_name = array('app', $name, 'iax2', $app_id);
56+
// Additional iax2 stats
57+
$rrd_name = ['app', $name, 'iax2', $app_id];
5858
$rrd_def = RrdDefinition::make()
5959
->addDataset('iax2peers', 'GAUGE', 0, 10000)
6060
->addDataset('iax2online', 'GAUGE', 0, 10000)
6161
->addDataset('iax2offline', 'GAUGE', 0, 10000)
6262
->addDataset('iax2unmonitored', 'GAUGE', 0, 10000);
6363

64-
$iax2_fields = array(
64+
$iax2_fields = [
6565
'iax2peers' => $asterisk['Iax2Peers'],
6666
'iax2online' => $asterisk['Iax2Online'],
6767
'iax2offline' => $asterisk['Iax2Offline'],
68-
'iax2unmonitored' => $asterisk['Iax2Unmonitored']
69-
);
68+
'iax2unmonitored' => $asterisk['Iax2Unmonitored'],
69+
];
7070

7171
$asterisk_metrics['iax2'] = $iax2_fields;
7272
$iax2_tags = compact('name', 'app_id', 'rrd_name', 'rrd_def');

includes/polling/applications/backupninja.inc.php

+8-7
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,34 @@
1212
} catch (JsonAppMissingKeysException $e) {
1313
$backupninja_data = $e->getParsedJson();
1414
} catch (JsonAppException $e) {
15-
echo PHP_EOL . $name . ':' .$e->getCode().':'. $e->getMessage() . PHP_EOL;
16-
update_application($app, $e->getCode().':'.$e->getMessage(), []); // Set empty metrics and error message
15+
echo PHP_EOL . $name . ':' . $e->getCode() . ':' . $e->getMessage() . PHP_EOL;
16+
update_application($app, $e->getCode() . ':' . $e->getMessage(), []); // Set empty metrics and error message
17+
1718
return;
1819
}
1920

20-
$metrics = array();
21+
$metrics = [];
2122

2223
$category = 'overview';
23-
$rrd_name = array('app', $name, $app_id, $category);
24+
$rrd_name = ['app', $name, $app_id, $category];
2425
$rrd_def = RrdDefinition::make()
2526
->addDataset('last_actions', 'GAUGE', 0)
2627
->addDataset('last_fatal', 'GAUGE', 0)
2728
->addDataset('last_error', 'GAUGE', 0)
2829
->addDataset('last_warning', 'GAUGE', 0);
2930

30-
$fields = array(
31+
$fields = [
3132
'last_actions' => $backupninja_data['last_actions'],
3233
'last_fatal' => $backupninja_data['last_fatal'],
3334
'last_error' => $backupninja_data['last_error'],
3435
'last_warning' => $backupninja_data['last_warning'],
35-
);
36+
];
3637
$metrics[$category] = $fields;
3738

3839
// Debug
3940
d_echo("backupninja : $fields");
4041

41-
$tags = array('name' => $name, 'app_id' => $app_id, 'rrd_def' => $rrd_def, 'rrd_name' => $rrd_name);
42+
$tags = ['name' => $name, 'app_id' => $app_id, 'rrd_def' => $rrd_def, 'rrd_name' => $rrd_name];
4243
data_update($device, 'app', $tags, $fields);
4344

4445
update_application($app, $output, $metrics);

0 commit comments

Comments
 (0)