Apply "Squiz" code style on old (pre-2014) files

This commit is contained in:
Job Snijders
2015-07-11 16:12:35 +02:00
parent e4f4eb44dc
commit ebd0f6fc35
539 changed files with 13591 additions and 13223 deletions
+33 -34
View File
@@ -10,51 +10,50 @@
* @subpackage alerts
* @author Adam Armstrong <[email protected]>
* @copyright (C) 2006 - 2012 Adam Armstrong
*
*/
chdir(dirname($argv[0]));
include("includes/defaults.inc.php");
include("config.php");
include("includes/definitions.inc.php");
include("includes/functions.php");
include("html/includes/functions.inc.php");
require 'includes/defaults.inc.php';
require 'config.php';
require 'includes/definitions.inc.php';
require 'includes/functions.php';
require 'html/includes/functions.inc.php';
// Check all of our interface RRD files for errors
if ($argv[1]) {
$where = 'AND `port_id` = ?';
$params = array($argv[1]);
}
if ($argv[1]) { $where = "AND `port_id` = ?"; $params = array($argv[1]); }
$i = 0;
$i = 0;
$errored = 0;
foreach (dbFetchRows("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id $where", $params) as $interface)
{
$errors = $interface['ifInErrors_delta'] + $interface['ifOutErrors_delta'];
if ($errors > '1')
{
$errored[] = generate_device_link($interface, $interface['hostname'] . " - " . $interface['ifDescr'] . " - " . $interface['ifAlias'] . " - " . $interface['ifInErrors_delta'] . " - " . $interface['ifOutErrors_delta']);
$errored++;
}
$i++;
}
foreach (dbFetchRows("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id $where", $params) as $interface) {
$errors = ($interface['ifInErrors_delta'] + $interface['ifOutErrors_delta']);
if ($errors > '1') {
$errored[] = generate_device_link($interface, $interface['hostname'].' - '.$interface['ifDescr'].' - '.$interface['ifAlias'].' - '.$interface['ifInErrors_delta'].' - '.$interface['ifOutErrors_delta']);
$errored++;
}
echo("Checked $i interfaces\n");
if (is_array($errored))
{ // If there are errored ports
$i = 0;
$msg = "Interfaces with errors : \n\n";
foreach ($errored as $int)
{
$msg .= "$int\n"; // Add a line to the report email warning about them
$i++;
}
// Send the alert email
notify($device, $config['project_name'] . " detected errors on $i interface" . ($i != 1 ? 's' : ''), $msg);
}
echo("$errored interfaces with errors over the past 5 minutes.\n");
echo "Checked $i interfaces\n";
?>
if (is_array($errored)) {
// If there are errored ports
$i = 0;
$msg = "Interfaces with errors : \n\n";
foreach ($errored as $int) {
$msg .= "$int\n";
// Add a line to the report email warning about them
$i++;
}
// Send the alert email
notify($device, $config['project_name']." detected errors on $i interface".($i != 1 ? 's' : ''), $msg);
}
echo "$errored interfaces with errors over the past 5 minutes.\n";