68 |
$mm =~ s/\D//g; |
$mm =~ s/\D//g; |
69 |
$dd =~ s/\D//g; |
$dd =~ s/\D//g; |
70 |
|
|
71 |
|
my $h = my $m = my $s = 0; |
72 |
|
if ($suffix eq 'to') { |
73 |
|
$h = 23; |
74 |
|
$m = 59; |
75 |
|
$s = 59; |
76 |
|
} |
77 |
|
|
78 |
my $dt = new DateTime( |
my $dt = new DateTime( |
79 |
year => $yyyy, |
year => $yyyy, |
80 |
month => $mm, |
month => $mm, |
81 |
day => $dd |
day => $dd, |
82 |
|
hour => $h, |
83 |
|
minute => $m, |
84 |
|
second => $s, |
85 |
); |
); |
86 |
print STDERR "mk_epoch_date($name,$suffix) [$yyyy-$mm-$dd] = " . $dt->ymd . " " . $dt->hms . "\n"; |
print STDERR "mk_epoch_date($name,$suffix) [$yyyy-$mm-$dd] = " . $dt->ymd . " " . $dt->hms . "\n"; |
87 |
return $dt->epoch || 'NULL'; |
return $dt->epoch || 'NULL'; |
110 |
push @conditions, qq{ files.date >= $files_from } if ($files_from); |
push @conditions, qq{ files.date >= $files_from } if ($files_from); |
111 |
push @conditions, qq{ files.date <= $files_to } if ($files_to); |
push @conditions, qq{ files.date <= $files_to } if ($files_to); |
112 |
|
|
113 |
print STDERR "backup: $backup_from - $backup_to files: $files_from - $files_to cond:" . join(" | ",@conditions); |
print STDERR "backup: $backup_from - $backup_to files: $files_from - $files_to cond:" . join(" and ",@conditions); |
114 |
|
|
115 |
push( @conditions, ' files.shareid = ' . $param->{'search_share'} ) if ($param->{'search_share'}); |
push( @conditions, ' files.shareid = ' . $param->{'search_share'} ) if ($param->{'search_share'}); |
116 |
push (@conditions, " upper(files.path) LIKE upper('%".$param->{'search_filename'}."%')") if ($param->{'search_filename'}); |
push (@conditions, " upper(files.path) LIKE upper('%".$param->{'search_filename'}."%')") if ($param->{'search_filename'}); |
298 |
$ret =~ s/\\h/$host/ge; |
$ret =~ s/\\h/$host/ge; |
299 |
$ret =~ s/\\s/$share/ge; |
$ret =~ s/\\s/$share/ge; |
300 |
$ret =~ s/\\n/$backupnum/ge; |
$ret =~ s/\\n/$backupnum/ge; |
301 |
|
|
302 |
|
$ret =~ s/__+/_/g; |
303 |
|
|
304 |
return $ret; |
return $ret; |
305 |
|
|
306 |
} |
} |
307 |
|
|
308 |
|
sub getGzipSize($$) |
309 |
|
{ |
310 |
|
my ($hostID, $backupNum) = @_; |
311 |
|
my $ret; |
312 |
|
my $sql; |
313 |
|
my $dbh = get_dbh(); |
314 |
|
|
315 |
|
$sql = q{ |
316 |
|
SELECT hosts.name as host, |
317 |
|
shares.name as share, |
318 |
|
backups.num as backupnum |
319 |
|
FROM hosts, backups, shares |
320 |
|
WHERE shares.id=backups.shareid AND |
321 |
|
hosts.id =backups.hostid AND |
322 |
|
hosts.id=? AND |
323 |
|
backups.num=? |
324 |
|
}; |
325 |
|
my $sth = $dbh->prepare($sql); |
326 |
|
$sth->execute($hostID, $backupNum); |
327 |
|
|
328 |
|
my $row = $sth->fetchrow_hashref(); |
329 |
|
|
330 |
|
my (undef,undef,undef,undef,undef,undef,undef,$ret,undef,undef,undef,undef,undef) = |
331 |
|
stat( $Conf{InstallDir}.'/'.$Conf{GzipTempDir}.'/'. |
332 |
|
getGzipName($row->{'host'}, $row->{share}, $row->{'backupnum'})); |
333 |
|
|
334 |
|
return $ret; |
335 |
|
} |
336 |
|
|
337 |
sub getBackupsNotBurned() { |
sub getBackupsNotBurned() { |
338 |
|
|
339 |
my $dbh = get_dbh(); |
my $dbh = get_dbh(); |
343 |
backups.hostID AS hostID, |
backups.hostID AS hostID, |
344 |
hosts.name AS host, |
hosts.name AS host, |
345 |
shares.name AS share, |
shares.name AS share, |
346 |
backups.id AS backupnum, |
backups.num AS backupnum, |
347 |
backups.type AS type, |
backups.type AS type, |
348 |
backups.date AS date, |
backups.date AS date, |
349 |
backups.size AS size |
backups.size AS size, |
350 |
|
backups.id AS id, |
351 |
|
backups.inc_size AS inc_size |
352 |
FROM backups |
FROM backups |
353 |
INNER JOIN shares ON backups.shareID=shares.ID |
INNER JOIN shares ON backups.shareID=shares.ID |
354 |
INNER JOIN hosts ON backups.hostID = hosts.ID |
INNER JOIN hosts ON backups.hostID = hosts.ID |
355 |
LEFT OUTER JOIN archive_backup ON archive_backup.backup_id = backups.id |
LEFT OUTER JOIN archive_backup ON archive_backup.backup_id = backups.id |
356 |
WHERE backups.size > 0 AND archive_backup.backup_id IS NULL |
WHERE backups.inc_size > 0 AND backups.inc_deleted is false AND archive_backup.backup_id IS NULL |
357 |
GROUP BY |
GROUP BY |
358 |
backups.hostID, |
backups.hostID, |
359 |
hosts.name, |
hosts.name, |
363 |
backups.id, |
backups.id, |
364 |
backups.type, |
backups.type, |
365 |
backups.date, |
backups.date, |
366 |
backups.size |
backups.size, |
367 |
|
backups.inc_size |
368 |
ORDER BY backups.date |
ORDER BY backups.date |
369 |
}; |
}; |
370 |
my $sth = $dbh->prepare( $sql ); |
my $sth = $dbh->prepare( $sql ); |
374 |
while ( my $row = $sth->fetchrow_hashref() ) { |
while ( my $row = $sth->fetchrow_hashref() ) { |
375 |
$row->{'age'} = sprintf("%0.1f", ( (time() - $row->{'date'}) / 86400 ) ); |
$row->{'age'} = sprintf("%0.1f", ( (time() - $row->{'date'}) / 86400 ) ); |
376 |
$row->{'size'} = sprintf("%0.2f", $row->{'size'} / 1024 / 1024); |
$row->{'size'} = sprintf("%0.2f", $row->{'size'} / 1024 / 1024); |
377 |
my (undef,undef,undef,undef,undef,undef,undef,$fs_size,undef,undef,undef,undef,undef) = |
|
378 |
stat( $Conf{InstallDir}.'/'.$Conf{GzipTempDir}.'/'. |
# do some cluster calculation (approximate) and convert to kB |
379 |
getGzipName($row->{'host'}, $row->{share}, $row->{'backupnum'})); |
$row->{'inc_size'} = int(($row->{'inc_size'} + 1023 ) / ( 2 * 1024 ) * 2); |
|
$row->{'fs_size'} = $fs_size; |
|
380 |
push @ret, $row; |
push @ret, $row; |
381 |
} |
} |
382 |
|
|
496 |
<!-- |
<!-- |
497 |
|
|
498 |
var debug_div = null; |
var debug_div = null; |
499 |
var media_size = 4400 * 1024; |
EOF3 |
500 |
|
|
501 |
|
# take maximum archive size from configuration |
502 |
|
$retHTML .= 'var media_size = '. $Conf{MaxArchiveSize} .';'; |
503 |
|
|
504 |
|
$retHTML .= <<'EOF3'; |
505 |
|
|
506 |
function debug(msg) { |
function debug(msg) { |
507 |
// return; // Disable debugging |
// return; // Disable debugging |
699 |
<td align="center">date</td> |
<td align="center">date</td> |
700 |
<td align="center">age/days</td> |
<td align="center">age/days</td> |
701 |
<td align="center">size/MB</td> |
<td align="center">size/MB</td> |
702 |
<td align="center">gzip size</td> |
<td align="center">gzip size/kB</td> |
703 |
</tr> |
</tr> |
704 |
|
|
705 |
}; |
}; |
717 |
} |
} |
718 |
my $ftype = ""; |
my $ftype = ""; |
719 |
|
|
720 |
|
my $checkbox_key = $backup->{'hostid'}. '_' .$backup->{'backupnum'} . '_' . $backup->{'id'}; |
721 |
|
|
722 |
$retHTML .= |
$retHTML .= |
723 |
'<tr' . $color[$i %2 ] . '> |
'<tr' . $color[$i %2 ] . '> |
724 |
<td class="fview">'; |
<td class="fview">'; |
725 |
# FIXME |
|
726 |
$backup->{'fs_size'} = int($backup->{'size'} * 1024); |
if (($backup->{'inc_size'} || 0) > 0) { |
|
if (($backup->{'fs_size'} || 0) > 0) { |
|
727 |
$retHTML .= ' |
$retHTML .= ' |
728 |
<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);">'; |
|
729 |
} |
} |
730 |
|
|
731 |
$retHTML .= |
$retHTML .= |
732 |
'</td>' . |
'</td>' . |
733 |
'<td align="right">' . $backup->{'host'} . ':' . $backup->{'share'} . '</td>' . |
'<td align="right">' . $backup->{'host'} . ':' . $backup->{'share'} . '</td>' . |
736 |
'<td align="center">' . epoch_to_iso( $backup->{'date'} ) . '</td>' . |
'<td align="center">' . epoch_to_iso( $backup->{'date'} ) . '</td>' . |
737 |
'<td align="center">' . $backup->{'age'} . '</td>' . |
'<td align="center">' . $backup->{'age'} . '</td>' . |
738 |
'<td align="right">' . $backup->{'size'} . '</td>' . |
'<td align="right">' . $backup->{'size'} . '</td>' . |
739 |
'<td align="right">' . $backup->{'fs_size'} . |
'<td align="right">' . $backup->{'inc_size'} . |
740 |
'<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>' . |
741 |
|
|
742 |
"</tr>\n"; |
"</tr>\n"; |
743 |
} |
} |