--- trunk/bin/BackupPC_burnArchiveCLI 2005/10/14 15:53:54 203 +++ trunk/bin/BackupPC_burnArchiveCLI 2005/10/14 16:46:33 204 @@ -67,11 +67,12 @@ sub dumpArchive2XML($$$) { my ($dbh, $dvd_nr, $filename) = @_; - my %archive; - my $output = new IO::File(">$filename"); + my %archive; + + my $output = new IO::File('> '.$filename.'.tmp'); my $writer = new XML::Writer(OUTPUT=>$output, NEWLINES => 1); - print "Dumping file list for DVD $dvd_nr"; + print "Dumping file list for DVD $dvd_nr, countdown:"; $writer->pi('xml-stylesheet', 'href="archive.css" type="text/css"'); @@ -123,9 +124,18 @@ my $sth_backups = $dbh->prepare( $backups_sql ); $sth_backups->execute( $row_h->{'id'} ); + my $total_backups = $sth_backups->rows; + my $curr_backup = 0; + my $last_pcnt = 0; + while (my $row = $sth_backups->fetchrow_hashref()) { - print "."; + $curr_backup++; + my $pcnt = int(($curr_backup * 10) / $total_backups); + if ($pcnt > $last_pcnt) { + print " ",(10 - $pcnt); + $last_pcnt = $pcnt; + } my $sth_files = $dbh->prepare( $files_sql); $sth_files->execute($row->{'backup_id'}); @@ -151,6 +161,8 @@ $writer->endTag("archive"); $writer->end(); + rename $filename.'.tmp', $filename || die "can't rename $filename: $!"; + print "\n"; }