--- trunk/lib/BackupPC/SearchLib.pm 2005/09/11 13:05:06 117 +++ trunk/lib/BackupPC/SearchLib.pm 2005/10/07 12:27:07 149 @@ -15,11 +15,7 @@ my $dsn = $Conf{SearchDSN}; my $db_user = $Conf{SearchUser} || ''; -my $index_path = $Conf{HyperEstraierIndex}; -if ($index_path) { - $index_path = $TopDir . '/' . $index_path; - $index_path =~ s#//#/#g; -} +my $hest_index_path = $Conf{HyperEstraierIndex}; my $dbh; @@ -198,11 +194,11 @@ my $offset = $param->{'offset'} || 0; $offset *= $on_page; - die "no index_path?" unless ($index_path); + die "no index_path?" unless ($hest_index_path); use HyperEstraier; - my ($index_path, $index_node_url) = getHyperEstraier_url($index_path); + my ($index_path, $index_node_url) = getHyperEstraier_url($hest_index_path); # open the database my $db; @@ -297,25 +293,65 @@ } +sub getGzipSize($$) +{ + my ($hostID, $backupNum) = @_; + my $ret; + my $sql; + my $dbh = get_dbh(); + + $sql = q{ + SELECT hosts.name as host, + shares.name as share, + backups.num as backupnum + FROM hosts, backups, shares + WHERE shares.id=backups.shareid AND + hosts.id =backups.hostid AND + hosts.id=? AND + backups.num=? + }; + my $sth = $dbh->prepare($sql); + $sth->execute($hostID, $backupNum); + + my $row = $sth->fetchrow_hashref(); + + my (undef,undef,undef,undef,undef,undef,undef,$ret,undef,undef,undef,undef,undef) = + stat( $Conf{InstallDir}.'/'.$Conf{GzipTempDir}.'/'. + getGzipName($row->{'host'}, $row->{share}, $row->{'backupnum'})); + + return $ret; +} + sub getBackupsNotBurned() { my $dbh = get_dbh(); - my $sql = q{ - SELECT - backups.hostID AS hostid, - min(hosts.name) AS host, - min(shares.name) AS share, - backups.num AS backupnum, - min(backups.type) AS type, - min(backups.date) AS date, - min(backups.size) AS size - FROM files - INNER JOIN shares ON files.shareID=shares.ID - INNER JOIN hosts ON hosts.ID = shares.hostID - INNER JOIN backups ON backups.num = files.backupnum and backups.hostID = hosts.ID AND backups.shareID = shares.ID - GROUP BY - backups.hostID, backups.num, backups.shareid - ORDER BY min(backups.date) + + my $sql = q{ + SELECT + backups.hostID AS hostID, + hosts.name AS host, + shares.name AS share, + backups.num AS backupnum, + backups.type AS type, + backups.date AS date, + backups.size AS size, + backups.id AS id + FROM backups + INNER JOIN shares ON backups.shareID=shares.ID + INNER JOIN hosts ON backups.hostID = hosts.ID + LEFT OUTER JOIN archive_backup ON archive_backup.backup_id = backups.id + WHERE backups.size > 0 AND archive_backup.backup_id IS NULL + GROUP BY + backups.hostID, + hosts.name, + shares.name, + backups.num, + backups.shareid, + backups.id, + backups.type, + backups.date, + backups.size + ORDER BY backups.date }; my $sth = $dbh->prepare( $sql ); my @ret; @@ -334,52 +370,325 @@ return @ret; } -sub displayBackupsGrid() - { - my $retHTML = ""; - - $retHTML .= < +sub displayBackupsGrid() { + + my $retHTML .= q{ +
+ }; + + $retHTML .= <<'EOF3'; + + +
+ +Size: kB + +
+
 
+
 
+
0%
+
+
+ +Note: + + + + +
+ EOF3 $retHTML .= q{ - - - - - - - - - - - - - - - - + + +
- - ShareBackup noTypedateage/dayssize/MBgzip size
- -
+ + + + + + + + + + + }; my @color = (' bgcolor="#e0e0e0"', ''); @@ -394,24 +703,33 @@ $host = $backup->{'host'}; } my $ftype = ""; - - $retHTML .= ""; - $retHTML .= ''; - + + my $checkbox_key = $backup->{'hostid'}. '_' .$backup->{'backupnum'} . '_' . $backup->{'id'}; + + $retHTML .= + ' + ' . '' . '' . '' . '' . '' . '' . - '' . - "\n"; - + '' . + "\n"; } $retHTML .= "
+ + ShareBackup noTypedateage/dayssize/MBgzip size
'; + + # FIXME + $backup->{'fs_size'} = int($backup->{'size'} * 1024); + + if (($backup->{'fs_size'} || 0) > 0) { + $retHTML .= ' + '; + } + $retHTML .= + '' . $backup->{'host'} . ':' . $backup->{'share'} . '' . $backup->{'backupnum'} . '' . $backup->{'type'} . '' . epoch_to_iso( $backup->{'date'} ) . '' . $backup->{'age'} . '' . $backup->{'size'} . '' . $backup->{'fs_size'} .'
' . $backup->{'fs_size'} . + '
";