X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=lib%2FBackupPC%2FCGI%2FSummary.pm;h=725e8505894f17da73864fd24fe44e271675f817;hp=71bbdeb142a9ab5308e37e94eecb8fb4a55a0003;hb=b81d2da5e16975674f011e4833337ac0fa24e0ea;hpb=e951f787a66c5bd9e9955c3f657a5b44289c0fe1 diff --git a/lib/BackupPC/CGI/Summary.pm b/lib/BackupPC/CGI/Summary.pm index 71bbdeb..725e850 100644 --- a/lib/BackupPC/CGI/Summary.pm +++ b/lib/BackupPC/CGI/Summary.pm @@ -28,7 +28,7 @@ # #======================================================================== # -# Version 2.1.0, released 20 Jun 2004. +# Version 3.0.0beta2, released 11 Nov 2006. # # See http://backuppc.sourceforge.net. # @@ -49,11 +49,12 @@ sub action my $Privileged = CheckPermission(); foreach my $host ( GetUserHosts(1) ) { - my($fullDur, $incrCnt, $incrAge, $fullSize, $fullRate, $reasonHilite); + my($fullDur, $incrCnt, $incrAge, $fullSize, $fullRate, $reasonHilite, + $lastAge, $tempState, $tempReason); my($shortErr); my @Backups = $bpc->BackupInfoRead($host); my $fullCnt = $incrCnt = 0; - my $fullAge = $incrAge = -1; + my $fullAge = $incrAge = $lastAge = -1; $bpc->ConfigRead($host); %Conf = $bpc->Conf(); @@ -78,6 +79,16 @@ sub action $incrSizeTot += $Backups[$i]{size} / (1024 * 1024); } } + if ( $fullAge > $incrAge && $fullAge >= 0 ) { + $lastAge = $fullAge; + } else { + $lastAge = $incrAge; + } + if ( $lastAge < 0 ) { + $lastAge = ""; + } else { + $lastAge = sprintf("%.1f", (time - $lastAge) / (24 * 3600)); + } if ( $fullAge < 0 ) { $fullAge = ""; $fullRate = ""; @@ -97,9 +108,22 @@ sub action $incrAge = " " if ( $incrAge eq "" ); $reasonHilite = $Conf{CgiStatusHilightColor}{$Status{$host}{reason}} || $Conf{CgiStatusHilightColor}{$Status{$host}{state}}; + if ( $Conf{BackupsDisable} == 1 ) { + $reasonHilite = $Conf{CgiStatusHilightColor}{Disabled_OnlyManualBackups}; + $tempState = "Disabled_OnlyManualBackups"; + $tempReason = ""; + } elsif ($Conf{BackupsDisable} == 2 ) { + $reasonHilite = $Conf{CgiStatusHilightColor}{Disabled_AllBackupsDisabled}; + $tempState = "Disabled_AllBackupsDisabled"; + $tempReason = ""; + } else { + $tempState = $Status{$host}{state}; + $tempReason = $Status{$host}{reason}; + } $reasonHilite = " bgcolor=\"$reasonHilite\"" if ( $reasonHilite ne "" ); - if ( $Status{$host}{state} ne "Status_backup_in_progress" - && $Status{$host}{state} ne "Status_restore_in_progress" + if ( $tempState ne "Status_backup_in_progress" + && $tempState ne "Status_restore_in_progress" + && $Conf{BackupsDisable} == 0 && $Status{$host}{error} ne "" ) { ($shortErr = $Status{$host}{error}) =~ s/(.{48}).*/$1.../; $shortErr = " ($shortErr)"; @@ -115,8 +139,9 @@ sub action $fullRate $incrCnt $incrAge - $Lang->{$Status{$host}{state}} - $Lang->{$Status{$host}{reason}}$shortErr + $lastAge + $Lang->{$tempState} + $Lang->{$tempReason}$shortErr EOF if ( @Backups == 0 ) { $hostCntNone++;