/[BackupPC]/trunk/lib/BackupPC/CGI/BurnMedia.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/CGI/BurnMedia.pm

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

revision 145 by dpavlin, Fri Oct 7 11:15:28 2005 UTC revision 154 by dpavlin, Mon Oct 10 12:07:13 2005 UTC
# Line 43  EOF Line 43  EOF
43                          if ($key =~ m/^fcb([0-9]+)_([0-9]+)_([0-9]+)$/gi) {                          if ($key =~ m/^fcb([0-9]+)_([0-9]+)_([0-9]+)$/gi) {
44                                  my ($host_id, $backup_num, $backup_id) = ($1,$2,$3);                                  my ($host_id, $backup_num, $backup_id) = ($1,$2,$3);
45                                  push @selected_backup_ids, $backup_id;                                  push @selected_backup_ids, $backup_id;
46                                  $total_size += getGzipSize($host_id, $backup_num);                                  $total_size += BackupPC::SearchLib::getGzipSize($host_id, $backup_num);
47                          }                          }
48                  }                  }
49    
                 # create new archive  
                 my $sth = $dbh->prepare(q{  
                                 INSERT INTO archive (  
                                         id,  
                                         dvd_nr,  
                                         note,  
                                         username,  
                                         date  
                                 ) VALUES (  
                                         nextVal('archive_id_seq'),  
                                         nextVal('dvd_nr'),  
                                         ?,  
                                         ?,  
                                         NOW()  
                                 )  
                 });  
   
                 # FIXME insert user here  
                 $sth->execute($In{'note'}, 'dummy_user');  
50    
51                  if ($total_size > $Conf{MaxArchiveSize}) {                  if ($total_size > $Conf{MaxArchiveSize}) {
52                          $cont .= eval( q{ ${h2(Error)}});                          $cont .= eval( q{ ${h2(Error)}});
53                          $cont .= "Selected backups exceed max archive size.";                          $cont .= "Selected backups exceed max archive size.";
54                  } else {                  } else {
55    
56                            # create new archive
57                            my $sth = $dbh->prepare(q{
58                                                            INSERT INTO archive (
59                                                                    id,
60                                                                    dvd_nr,
61                                                                    note,
62                                                                    username,
63                                                                    date
64                                                            ) VALUES (
65                                                                    nextVal('archive_id_seq'),
66                                                                    nextVal('dvd_nr'),
67                                                                    ?,
68                                                                    ?,
69                                                                    NOW()
70                                                            )
71                                                    });
72    
73                            # FIXME insert user here
74                            $sth->execute($In{'note'}, 'dummy_user');
75    
76                          foreach my $backup_id (@selected_backup_ids) {                          foreach my $backup_id (@selected_backup_ids) {
77    
78                                  # link backups with archive                                  # link backups with archive
79                                  my $sth = $dbh->prepare(q{                                  my $sth = $dbh->prepare(q{
80                                          INSERT INTO archive_backup (                                          INSERT INTO archive_backup (
81                                                  archive_id, backup_id, status                                                  archive_id, backup_id
82                                          ) VALUES (                                          ) VALUES (
83                                                  (SELECT last_value FROM archive_id_seq), ?, ?                                                  (SELECT last_value FROM archive_id_seq), ?
84                                          )                                          )
85                                  });                                  });
86    
87                                  $sth->execute($backup_id, 'ok');                                  $sth->execute($backup_id);
88    
89                                  $dbh->commit();                                  $dbh->commit();
90    
                                 $cont .= qq{  
                                         Archived following backups:  
                                 } . join(",", @selected_backup_ids) . qq{  
                                         <br/>with following message:  
                                         <div style="border: 1px solid #e0e0e0">  
                                 } . $In{'note'} . qq{  
                                         </div>  
                                 };  
91                          }                          }
92    
93                            my ($dvd_nr) = $dbh->selectrow_array(qq{
94                                    select last_value from dvd_nr
95                            });
96    
97                            $dvd_nr ||= 'error';
98    
99                            $dbh->commit();
100    
101                            $cont .= q{
102                                    Archived following backups:
103                            } . join(", ", @selected_backup_ids) . q{
104                                    <br/>with total size of
105                            <b>} . sprintf("%1.2f Mb", $total_size / 1024) . q{</b>
106                                    to media <b>} . $dvd_nr . q{</b>
107                                    with following message:
108                                    <div style="background-color: #e0e0e0; display: inline; padding: 2px;">
109                            } . $In{'note'} . q{
110                                    </div>
111                            };
112                  }                  }
113          }          }
114    

Legend:
Removed from v.145  
changed lines
  Added in v.154

  ViewVC Help
Powered by ViewVC 1.1.26