=cut
-# TODO:
-# Si c'est un fichier selectionne, afficher ses attributs
-# ajouter le base_fic et base_url dans les options bweb
-#
-
use strict;
+use POSIX qw/strftime/;
use Bweb;
use CCircle ;
use Digest::MD5 qw(md5_hex);
use File::Basename qw/basename dirname/;
-my $conf = new Bweb::Config(config_file => '/etc/bweb/config');
+my $conf = new Bweb::Config(config_file => $Bweb::config_file);
$conf->load();
my $bweb = new Bweb(info => $conf);
$bweb->connect_db();
my $base_url = '/bweb/fv' ;
my $base_fich = $conf->{fv_write_path};
-die "Can't get where" unless ($where and $jobid);
-
-if ($batch eq 'batch') {
+if ($where and $jobid and $batch eq 'batch') {
my $root = fv_get_root_pathid($where);
if ($root) {
fv_compute_size($jobid, $root);
exit 1;
}
-my $url_action = "bfileview.pl?opt_level=$opt_level" ;
-my $top = new CCircle(
- display_other => 1,
- base_url => "$url_action;$jobid_url;where=$where",
- ) ;
-
print CGI::header('text/html');
$bweb->display_begin();
$bweb->display_job_zoom($jobid);
+unless ($where and $jobid) {
+ $bweb->error("Can't get where or jobid");
+ exit 0;
+}
+
+unless ($base_fich and -w $base_fich) {
+ $bweb->error("fv_write_path ($base_fich) is not writable." .
+ " See Bweb configuration.");
+ exit 0;
+}
+
if (-f "$base_fich/$md5_rep.png" and -f "$base_fich/$md5_rep.tpl")
{
$bweb->display({}, "$base_fich/$md5_rep.tpl");
my $total = fv_compute_size($jobid, $root);
+my $url_action = "bfileview.pl?opt_level=$opt_level" ;
+my $top = new CCircle(
+ display_other => 1,
+ base_url => "$url_action;$jobid_url;where=$where",
+ ) ;
+
fv_display_rep($top, $total, $root, $opt_level) ;
$top->draw_labels() ;
my $size = fv_compute_size($jobid, $dir->[0]);
$sum += $size;
- my $chld = $ccircle->add_part($size * 100 / $max,
+ my $per = $size * 100 / $max;
+ my $chld = $ccircle->add_part($per,
basename($dir->[1]) . '/',
basename($dir->[1])
- . "\n"
+ . sprintf(' %.0f%% ', $per)
. Bweb::human_size($size)
) ;
if ($sum < $max) {
$ccircle->add_part(($max - $sum) * 100 / $max,
- "other files < 3",
+ "other files < 3%",
"other\n" . Bweb::human_size($max - $sum));
}
my $ret = $bweb->dbh_selectall_arrayref("
SELECT P.PathId,
- (
- SELECT Path FROM Path WHERE PathId = P.PathId
- UNION
- SELECT Path FROM brestore_missing_path WHERE PathId = P.PathId
- ) AS Path
+ ( SELECT Path FROM Path WHERE PathId = P.PathId) AS Path
FROM (
SELECT PathId
FROM brestore_pathvisibility
my $path = $bweb->dbh_quote(dirname($full_name) . "/");
my $attr = $bweb->dbh_selectrow_hashref("
- SELECT 1 AS found,
- base64_decode_lstat(8, lstat) AS size
+ SELECT 1 AS found,
+ MD5 AS md5,
+ base64_decode_lstat(8, LStat) AS size,
+ base64_decode_lstat(11, LStat) AS atime,
+ base64_decode_lstat(12, LStat) AS mtime,
+ base64_decode_lstat(13, LStat) AS ctime
+
FROM File INNER JOIN Filename USING (FilenameId)
INNER JOIN Path USING (PathId)
WHERE Name = $filename
$attr->{filename} = $full_name;
$attr->{size} = Bweb::human_size($attr->{size});
+ foreach my $d (qw/atime ctime mtime/) {
+ $attr->{$d} = strftime('%F %H:%M', localtime($attr->{$d}));
+ }
return $attr;
}
my ($jobid, $rep) = @_;
my $ret = $bweb->dbh_selectrow_hashref("
- SELECT sum(base64_decode_lstat(8,lstat)) AS size
+ SELECT sum(base64_decode_lstat(8,LStat)) AS size
FROM File
WHERE PathId = $rep
AND JobId = $jobid
my $ret = $bweb->dbh_selectall_arrayref("
SELECT Name, size
FROM (
- SELECT FilenameId,base64_decode_lstat(8,lstat) AS size
+ SELECT FilenameId,base64_decode_lstat(8,LStat) AS size
FROM File
WHERE PathId = $rep
AND JobId = $jobid
{
my ($path) = @_;
$path = $bweb->dbh_quote($path);
- my $ret = $bweb->dbh_selectrow_hashref("
-SELECT PathId FROM Path WHERE Path = $path
- UNION
-SELECT PathId FROM brestore_missing_path WHERE PATH = $path
-");
+ my $ret = $bweb->dbh_selectrow_hashref("SELECT PathId FROM Path WHERE Path = $path");
return $ret->{pathid};
}
END;
$$ language 'plpgsql';
-ALTER TABLE brestore_pathvisibility ADD Size int8;
+ALTER TABLE brestore_pathvisibility ADD Size int8;
+
+
+
+ALTER TABLE brestore_pathvisibility ADD Files int4;