/[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 143 by iklaric, Fri Oct 7 09:36:10 2005 UTC revision 161 by dpavlin, Mon Oct 10 13:39:13 2005 UTC
# Line 288  sub getGzipName($$$) Line 288  sub getGzipName($$$)
288          $ret =~ s/\\h/$host/ge;          $ret =~ s/\\h/$host/ge;
289          $ret =~ s/\\s/$share/ge;          $ret =~ s/\\s/$share/ge;
290          $ret =~ s/\\n/$backupnum/ge;          $ret =~ s/\\n/$backupnum/ge;
291            
292            $ret =~ s/__+/_/g;
293    
294          return $ret;          return $ret;
295                    
296  }  }
# Line 308  sub getGzipSize($$) Line 310  sub getGzipSize($$)
310                                  WHERE shares.id=backups.shareid AND                                  WHERE shares.id=backups.shareid AND
311                                            hosts.id =backups.hostid AND                                            hosts.id =backups.hostid AND
312                                            hosts.id=? AND                                            hosts.id=? AND
313                                            backups.num=?;                                            backups.num=?
314                          };                          };
315          my $sth = $dbh->prepare($sql);          my $sth = $dbh->prepare($sql);
316          $sth->execute($hostID, $backupNUM);          $sth->execute($hostID, $backupNum);
317          my $row = $res->fetchrow_hashref();  
318            my $row = $sth->fetchrow_hashref();
319                    
320          my (undef,undef,undef,undef,undef,undef,undef,$ret,undef,undef,undef,undef,undef) =          my (undef,undef,undef,undef,undef,undef,undef,$ret,undef,undef,undef,undef,undef) =
321                          stat( $Conf{InstallDir}.'/'.$Conf{GzipTempDir}.'/'.                          stat( $Conf{InstallDir}.'/'.$Conf{GzipTempDir}.'/'.
# Line 330  sub getBackupsNotBurned() { Line 333  sub getBackupsNotBurned() {
333                          backups.hostID AS hostID,                          backups.hostID AS hostID,
334                          hosts.name AS host,                          hosts.name AS host,
335                          shares.name AS share,                          shares.name AS share,
336                          backups.id AS backupnum,                          backups.num AS backupnum,
337                          backups.type AS type,                          backups.type AS type,
338                          backups.date AS date,                          backups.date AS date,
339                          backups.size AS size                          backups.size AS size,
340                            backups.id AS id,
341                            backups.inc_size AS inc_size
342                  FROM backups                  FROM backups
343                  INNER JOIN shares       ON backups.shareID=shares.ID                  INNER JOIN shares       ON backups.shareID=shares.ID
344                  INNER JOIN hosts        ON backups.hostID = hosts.ID                  INNER JOIN hosts        ON backups.hostID = hosts.ID
345                  LEFT OUTER JOIN archive_backup ON archive_backup.backup_id = backups.id                  LEFT OUTER JOIN archive_backup ON archive_backup.backup_id = backups.id
346                  WHERE backups.size > 0 AND archive_backup.backup_id IS NULL                  WHERE backups.size > 0 AND backups.inc_size > 0 AND archive_backup.backup_id IS NULL
347                  GROUP BY                  GROUP BY
348                          backups.hostID,                          backups.hostID,
349                          hosts.name,                          hosts.name,
# Line 348  sub getBackupsNotBurned() { Line 353  sub getBackupsNotBurned() {
353                          backups.id,                          backups.id,
354                          backups.type,                          backups.type,
355                          backups.date,                          backups.date,
356                          backups.size                          backups.size,
357                            backups.inc_size
358                  ORDER BY backups.date                  ORDER BY backups.date
359          };          };
360          my $sth = $dbh->prepare( $sql );          my $sth = $dbh->prepare( $sql );
# Line 358  sub getBackupsNotBurned() { Line 364  sub getBackupsNotBurned() {
364          while ( my $row = $sth->fetchrow_hashref() ) {          while ( my $row = $sth->fetchrow_hashref() ) {
365                  $row->{'age'} = sprintf("%0.1f", ( (time() - $row->{'date'}) / 86400 ) );                  $row->{'age'} = sprintf("%0.1f", ( (time() - $row->{'date'}) / 86400 ) );
366                  $row->{'size'} = sprintf("%0.2f", $row->{'size'} / 1024 / 1024);                  $row->{'size'} = sprintf("%0.2f", $row->{'size'} / 1024 / 1024);
367                  my (undef,undef,undef,undef,undef,undef,undef,$fs_size,undef,undef,undef,undef,undef) =  
368                          stat( $Conf{InstallDir}.'/'.$Conf{GzipTempDir}.'/'.                  # do some cluster calculation (approximate) and convert to kB
369                                  getGzipName($row->{'host'}, $row->{share}, $row->{'backupnum'}));                  $row->{'inc_size'} = int($row->{'inc_size'} / ( 2 * 1024) * 2);
                 $row->{'fs_size'} = $fs_size;  
370                  push @ret, $row;                  push @ret, $row;
371          }          }
372                
# Line 481  DIV#fixedBox #submitBurner { Line 486  DIV#fixedBox #submitBurner {
486  <!--  <!--
487    
488  var debug_div = null;  var debug_div = null;
489  var media_size = 4400 * 1024;  EOF3
490    
491            # take maximum archive size from configuration
492            $retHTML .= 'var media_size = '. $Conf{MaxArchiveSize} .';';
493    
494            $retHTML .= <<'EOF3';
495    
496  function debug(msg) {  function debug(msg) {
497  //      return; // Disable debugging  //      return; // Disable debugging
# Line 679  EOF3 Line 689  EOF3
689                          <td align="center">date</td>                          <td align="center">date</td>
690                          <td align="center">age/days</td>                          <td align="center">age/days</td>
691                          <td align="center">size/MB</td>                          <td align="center">size/MB</td>
692                          <td align="center">gzip size</td>                          <td align="center">gzip size/kB</td>
693                          </tr>                          </tr>
694    
695          };          };
# Line 697  EOF3 Line 707  EOF3
707                  }                  }
708                  my $ftype = "";                  my $ftype = "";
709    
710                    my $checkbox_key = $backup->{'hostid'}. '_' .$backup->{'backupnum'} . '_' . $backup->{'id'};
711    
712                  $retHTML .=                  $retHTML .=
713                          '<tr' . $color[$i %2 ] . '>                          '<tr' . $color[$i %2 ] . '>
714                          <td class="fview">';                          <td class="fview">';
715                  # FIXME  
716                  $backup->{'fs_size'} = int($backup->{'size'} * 1024);                  if (($backup->{'inc_size'} || 0) > 0) {
                 if (($backup->{'fs_size'} || 0) > 0) {  
717                          $retHTML .= '                          $retHTML .= '
718                          <input type="checkbox" name="fcb' .                          <input type="checkbox" name="fcb' . $checkbox_key . '" value="' . $checkbox_key . '" onClick="sumiraj(this);">';
                         $backup->{'hostid'}.'_'.$backup->{'backupnum'} .  
                         '" value="' . $backup->{'hostid'}.'_'.$backup->{'backupnum'} .  
                         '" onClick="sumiraj(this);">';  
719                  }                  }
720    
721                  $retHTML .=                  $retHTML .=
722                          '</td>' .                          '</td>' .
723                          '<td align="right">' . $backup->{'host'} . ':' . $backup->{'share'} . '</td>' .                          '<td align="right">' . $backup->{'host'} . ':' . $backup->{'share'} . '</td>' .
# Line 717  EOF3 Line 726  EOF3
726                          '<td align="center">' . epoch_to_iso( $backup->{'date'} ) . '</td>' .                          '<td align="center">' . epoch_to_iso( $backup->{'date'} ) . '</td>' .
727                          '<td align="center">' . $backup->{'age'} . '</td>' .                          '<td align="center">' . $backup->{'age'} . '</td>' .
728                          '<td align="right">' . $backup->{'size'} . '</td>' .                          '<td align="right">' . $backup->{'size'} . '</td>' .
729                          '<td align="right">' . $backup->{'fs_size'} .                          '<td align="right">' . $backup->{'inc_size'} .
730                          '<input type="hidden" iD="fss'.$backup->{'hostid'}.'_'.$backup->{'backupnum'} . '" value="'. $backup->{'fs_size'} .'"></td>' .                          '<input type="hidden" iD="fss'.$checkbox_key .'" value="'. $backup->{'inc_size'} .'"></td>' .
731    
732                          "</tr>\n";                          "</tr>\n";
733          }          }

Legend:
Removed from v.143  
changed lines
  Added in v.161

  ViewVC Help
Powered by ViewVC 1.1.26