/[BackupPC]/trunk/lib/BackupPC/SearchLib.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/BackupPC/SearchLib.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 188 by dpavlin, Wed Oct 12 16:49:02 2005 UTC revision 194 by dpavlin, Thu Oct 13 17:11:59 2005 UTC
# Line 307  sub getGzipName($$$) Line 307  sub getGzipName($$$)
307                    
308  }  }
309    
310    sub get_tgz_size_by_name($) {
311            my $name = shift;
312    
313            my $tgz = $Conf{InstallDir}.'/'.$Conf{GzipTempDir}.'/'.$name;
314    
315            my $size = -1;
316    
317            if (-f $tgz) {
318                    $size = (stat($tgz))[7];
319            } elsif (-d $tgz) {
320                    opendir(my $dir, $tgz) || die "can't opendir $tgz: $!";
321                    my @parts = grep { !/^\./ && -f "$tgz/$_" } readdir($dir);
322                    $size = 0;
323                    foreach my $part (@parts) {
324                            $size += (stat("$tgz/$part"))[7] || die "can't stat $tgz/$part: $!";
325                    }
326                    closedir $dir;
327            }
328    
329            return $size;
330    }
331    
332  sub getGzipSize($$)  sub getGzipSize($$)
333  {  {
334          my ($hostID, $backupNum) = @_;          my ($hostID, $backupNum) = @_;
# Line 327  sub getGzipSize($$) Line 349  sub getGzipSize($$)
349          $sth->execute($hostID, $backupNum);          $sth->execute($hostID, $backupNum);
350    
351          my $row = $sth->fetchrow_hashref();          my $row = $sth->fetchrow_hashref();
352            
353          my (undef,undef,undef,undef,undef,undef,undef,$ret,undef,undef,undef,undef,undef) =          return get_tgz_size_by_name(
354                          stat( $Conf{InstallDir}.'/'.$Conf{GzipTempDir}.'/'.                  getGzipName($row->{'host'}, $row->{share}, $row->{'backupnum'})
355                                  getGzipName($row->{'host'}, $row->{share}, $row->{'backupnum'}));          );
           
         return $ret;      
356  }  }
357    
358  sub getBackupsNotBurned() {  sub getBackupsNotBurned() {

Legend:
Removed from v.188  
changed lines
  Added in v.194

  ViewVC Help
Powered by ViewVC 1.1.26