X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=cgi-bin%2FBackupPC_Admin;h=6e9d9f58f8680ceef4c27ccc9c599a057f612245;hp=a2eefad33d4a9855b5249edd3dc7b2e79b00efa9;hb=7dee89bfce659051d486cc66515bb7f22bbc4f09;hpb=d422c3ce2641545c262cc6e09220c79f8d0a16e9 diff --git a/cgi-bin/BackupPC_Admin b/cgi-bin/BackupPC_Admin index a2eefad..6e9d9f5 100755 --- a/cgi-bin/BackupPC_Admin +++ b/cgi-bin/BackupPC_Admin @@ -107,7 +107,7 @@ if ( !defined($Hosts) || $bpc->HostsMTime() != $HostsMTime ) { $HostsMTime = $bpc->HostsMTime(); $Hosts = $bpc->HostInfoRead(); - # turn operators list into a hash for quick lookups + # turn moreUsers list into a hash for quick lookups foreach my $host (keys %$Hosts) { $Hosts->{$host}{moreUsers} = {map {$_, 1} split(",", $Hosts->{$host}{moreUsers}) } @@ -156,7 +156,7 @@ sub Action_Summary ErrorExit($Lang->{Only_privileged_users_can_view_PC_summaries} ); } foreach my $host ( sort(keys(%Status)) ) { - my($fullDur, $incrCnt, $incrAge, $fullSize, $fullRate); + my($fullDur, $incrCnt, $incrAge, $fullSize, $fullRate, $reasonHilite); my @Backups = $bpc->BackupInfoRead($host); my $fullCnt = $incrCnt = 0; my $fullAge = $incrAge = -1; @@ -193,9 +193,12 @@ sub Action_Summary $fullTot += $fullCnt; $incrTot += $incrCnt; $fullSize = sprintf("%.2f", $fullSize / 1000); - if (! $incrAge) { $incrAge = " "; } + $incrAge = " " if ( $incrAge eq "" ); + $reasonHilite = $Conf{CgiStatusHilightColor}{$Status{$host}{reason}}; + $reasonHilite = " bgcolor=\"$reasonHilite\"" if ( $reasonHilite ne "" ); + $str = < ${HostLink($host)} + ${HostLink($host)} ${UserLink($Hosts->{$host}{user})} $fullCnt $fullAge @@ -312,12 +315,12 @@ EOF while ( @CmdQueue ) { my $req = pop(@CmdQueue); my $reqTime = timeStamp2($req->{reqTime}); - (my $cmd = $req->{cmd}) =~ s/$BinDir\///; + (my $cmd = $req->{cmd}[0]) =~ s/$BinDir\///; $strCmd .= < ${HostLink($req->{host})} $reqTime $req->{user} - $cmd + $cmd $req->{cmd}[0] EOF } Header($Lang->{BackupPC__Queue_Summary}); @@ -349,16 +352,16 @@ sub Action_View } elsif ( $type eq "XferErrbad" ) { $file = "$TopDir/pc/$host/SmbLOG.bad"; $file = "$TopDir/pc/$host/XferLOG.bad" if ( !-f $file && !-f "$file.z"); - $comment = "(Extracting only Errors)"; + $comment = $Lang->{Extracting_only_Errors}; } elsif ( $type eq "XferErr" ) { $file = "$TopDir/pc/$host/SmbLOG$ext"; $file = "$TopDir/pc/$host/XferLOG$ext" if ( !-f $file && !-f "$file.z"); - $comment = "(Extracting only Errors)"; + $comment = $Lang->{Extracting_only_Errors}; } elsif ( $type eq "RestoreLOG" ) { $file = "$TopDir/pc/$host/RestoreLOG$ext"; } elsif ( $type eq "RestoreErr" ) { $file = "$TopDir/pc/$host/RestoreLOG$ext"; - $comment = "(Extracting only Errors)"; + $comment = $Lang->{Extracting_only_Errors}; } elsif ( $host ne "" && $type eq "config" ) { $file = "$TopDir/pc/$host/config.pl"; $file = "$TopDir/conf/$host.pl" @@ -859,10 +862,6 @@ EOF # # Provide the selected files via a tar archive. # - # We no longer use fork/exec (as in v1.5.0) since some mod_perls - # do not correctly preserve the stdout connection to the client - # browser, so we execute BackupPC_tarCreate in-line. - # my @fileListTrim = @fileList; if ( @fileListTrim > 10 ) { @fileListTrim = (@fileListTrim[0..9], '...'); @@ -873,33 +872,30 @@ EOF if ( $In{relative} ) { @pathOpts = ("-r", $pathHdr, "-p", ""); } - # - # We use syswrite since BackupPC_tarCreate uses syswrite too. - # Need to test this with mod_perl: PaulL says it doesn't work. - # - syswrite(STDOUT, <cmdSystemOrEval(["$BinDir/BackupPC_tarCreate", + "-h", $host, + "-n", $num, + "-s", $share, + @pathOpts, + @fileList + ], + sub { print(@_); } ); - do "$BinDir/BackupPC_tarCreate"; } elsif ( $In{type} == 2 ) { # # Provide the selected files via a zip archive. # - # We no longer use fork/exec (as in v1.5.0) since some mod_perls - # do not correctly preserve the stdout connection to the client - # browser, so we execute BackupPC_tarCreate in-line. - # my @fileListTrim = @fileList; if ( @fileListTrim > 10 ) { @fileListTrim = (@fileListTrim[0..9], '...'); @@ -910,27 +906,28 @@ EOF if ( $In{relative} ) { @pathOpts = ("-r", $pathHdr, "-p", ""); } - # - # We use syswrite since BackupPC_tarCreate uses syswrite too. - # Need to test this with mod_perl: PaulL says it doesn't work. - # - syswrite(STDOUT, <cmdSystemOrEval(["$BinDir/BackupPC_zipCreate", + "-h", $host, + "-n", $num, + "-c", $In{compressLevel}, + "-s", $share, + @pathOpts, + @fileList + ], + sub { print(@_); } + ); } elsif ( $In{type} == 3 ) { # # Do restore directly onto host @@ -1262,8 +1259,8 @@ EOF $errStr .= < $Backups[$i]{num} $ltype - XferLOG, - Errors + $Lang->{XferLOG}, + $Lang->{Errors} $Backups[$i]{xferErrs} $Backups[$i]{xferBadFile} $Backups[$i]{xferBadShare} @@ -1395,7 +1392,7 @@ sub Action_GeneralInfo GetStatusInfo("info jobs hosts queueLen"); my $Privileged = CheckPermission(); - my($jobStr, $statusStr, $tarPidHdr); + my($jobStr, $statusStr); foreach my $host ( sort(keys(%Jobs)) ) { my $startTime = timeStamp2($Jobs{$host}{startTime}); next if ( $host eq $bpc->trashJob @@ -1403,6 +1400,7 @@ sub Action_GeneralInfo $Jobs{$host}{type} = $Status{$host}{type} if ( $Jobs{$host}{type} eq "" && defined($Status{$host})); (my $cmd = $Jobs{$host}{cmd}) =~ s/$BinDir\///g; + (my $xferPid = $Jobs{$host}{xferPid}) =~ s/,/, /g; $jobStr .= < ${HostLink($host)} $Jobs{$host}{type} @@ -1410,12 +1408,8 @@ sub Action_GeneralInfo $startTime $cmd $Jobs{$host}{pid} - $Jobs{$host}{xferPid} + $xferPid EOF - if ( $Jobs{$host}{tarPid} > 0 ) { - $jobStr .= " $Jobs{$host}{tarPid} \n"; - $tarPidHdr ||= " tar PID \n"; - } $jobStr .= "\n"; } foreach my $host ( sort(keys(%Status)) ) { @@ -1432,8 +1426,8 @@ EOF || -f "$TopDir/pc/$host/XferLOG.bad.z" ) { $XferViewStr = <XferLOG, -XferErr +$Lang->{XferLOG}, +$Lang->{Errors} EOF } else { $XferViewStr = ""; @@ -1683,7 +1677,7 @@ sub CheckPermission } $PrivAdmin = $Privileged; $Privileged ||= $User eq $Hosts->{$host}{user}; - $Privileged ||= defined($Hosts->{$host}{operators}{$User}); + $Privileged ||= defined($Hosts->{$host}{moreUsers}{$User}); return $Privileged; }