Indent and comment code

master
Heuzef 5 years ago
parent 7e8c097297
commit 2bd44519a4
  1. 23
      Check.pm

@ -29,6 +29,7 @@ use Data::Dumper;
sub action
{
# Init
my($fullTot, $fullSizeTot, $incrTot, $incrSizeTot, $str,
$strNone, $strGood, $hostCntGood, $hostCntNone);
@ -36,6 +37,7 @@ sub action
GetStatusInfo("hosts info");
my $Privileged = CheckPermission();
# Start loop
foreach my $host ( GetUserHosts(1) ) {
my($fullDur, $incrCnt, $incrAge, $fullSize, $fullRate, $reasonHilite,
$lastAge, $lastAgeColor, $tempState, $tempReason, $lastXferErrors, $lastXferErrorsColor);
@ -50,6 +52,7 @@ sub action
next if ( $Conf{XferMethod} eq "archive" );
next if ( !$Privileged && !CheckPermission($host) );
# Age
for ( my $i = 0 ; $i < @Backups ; $i++ ) {
if ( $Backups[$i]{type} eq "full" ) {
$fullCnt++;
@ -77,6 +80,7 @@ sub action
} else {
$lastAge = sprintf("%.1f", (time - $lastAge) / (24 * 3600));
}
# Color for age
if ( $lastAge < 1.1 ) {
$lastAgeColor = "MediumSeaGreen";
} else {
@ -99,15 +103,18 @@ sub action
$incrTot += $incrCnt;
$fullSize = sprintf("%.2f", $fullSize / 1024);
$incrAge = "&nbsp;" if ( $incrAge eq "" );
# Color for errors
$lastXferErrors = $Backups[@Backups-1]{xferErrs} if ( @Backups );
if ( $lastXferErrors == 0 ) {
$lastXferErrorsColor = "MediumSeaGreen";
} else {
$lastAgeColor = "Tomato";
}
$reasonHilite = $Conf{CgiStatusHilightColor}{$Status{$host}{reason}}
|| $Conf{CgiStatusHilightColor}{$Status{$host}{state}};
if ( $Conf{BackupsDisable} == 1 ) {
$reasonHilite = $Conf{CgiStatusHilightColor}{$Status{$host}{reason}} || $Conf{CgiStatusHilightColor}{$Status{$host}{state}};
# If Backup is disable
if ( $Conf{BackupsDisable} == 1 ) {
if ( $Status{$host}{state} ne "Status_backup_in_progress"
&& $Status{$host}{state} ne "Status_restore_in_progress" ) {
$reasonHilite = $Conf{CgiStatusHilightColor}{Disabled_OnlyManualBackups};
@ -134,6 +141,7 @@ $reasonHilite = $Conf{CgiStatusHilightColor}{$Status{$host}{reason}}
$shortErr = " ($shortErr)";
}
# Show summary
$str = <<EOF;
<tr$reasonHilite><td class="border">${HostLink($host)}</td>
<td align="center" class="border" style="color:$lastAgeColor;">$lastAge</td>
@ -141,6 +149,8 @@ $reasonHilite = $Conf{CgiStatusHilightColor}{$Status{$host}{reason}}
<td align="center" class="border">sizeConsistency</td>
<td align="center" class="border"><a href="#" target="_blank">random-file.txt</a></td>
EOF
# Increment counter
if ( @Backups == 0 ) {
$hostCntNone++;
$strNone .= $str;
@ -150,9 +160,10 @@ EOF
}
}
$fullSizeTot = sprintf("%.2f", $fullSizeTot / 1024);
$incrSizeTot = sprintf("%.2f", $incrSizeTot / 1024);
my $now = timeStamp2(time);
# Time set
$fullSizeTot = sprintf("%.2f", $fullSizeTot / 1024);
$incrSizeTot = sprintf("%.2f", $incrSizeTot / 1024);
my $now = timeStamp2(time);
my $DUlastTime = timeStamp2($Info{DUlastValueTime});
my $DUmaxTime = timeStamp2($Info{DUDailyMaxTime});
my $DUInodemaxTime = timeStamp2($Info{DUInodeDailyMaxTime});

Loading…
Cancel
Save