From 74bed584a6e834ecb88b7de619da35649229a9e6 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Sat, 30 Dec 2006 10:54:47 +0000 Subject: [PATCH] ebl fix documenation to activate bfileview ebl add a confirm box when jobfiles > 5000 ebl cleanup fv_file_attribs.pl ebl add apache configuration example git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3862 91ce42f0-d328-0410-95d8-f526ca767f89 --- gui/bweb/INSTALL | 5 +++- gui/bweb/cgi/bfileview.pl | 31 ++++++++++++++++++----- gui/bweb/lang/fr/tpl/display_job_zoom.tpl | 4 ++- gui/bweb/lang/fr/tpl/fv_file_attribs.tpl | 14 ++++++++-- gui/bweb/script/bweb.conf | 9 +++++++ gui/bweb/tpl/display_job_zoom.tpl | 4 +-- gui/bweb/tpl/fv_file_attribs.tpl | 14 ++++++++-- 7 files changed, 66 insertions(+), 15 deletions(-) diff --git a/gui/bweb/INSTALL b/gui/bweb/INSTALL index c186811026..fd11b7bac4 100644 --- a/gui/bweb/INSTALL +++ b/gui/bweb/INSTALL @@ -189,10 +189,13 @@ mkdir /var/spool/bweb chmod 700 /var/spool/bweb chown www-data /var/spool/bweb +You have to remove "" from +tpl/display_job_zoom.tpl. + You must use brestore.pl -b to initialise the database, and you can use bfileview.pl mode=batch jobid=xxx where=/ to compute tree size. -At this time, it's a good idea to schedule brestore.pl -g after your +At this time, it's a good idea to schedule brestore.pl -b after your BackupCatalog job. Job { diff --git a/gui/bweb/cgi/bfileview.pl b/gui/bweb/cgi/bfileview.pl index ff4086e9a1..87ca7029ca 100755 --- a/gui/bweb/cgi/bfileview.pl +++ b/gui/bweb/cgi/bfileview.pl @@ -43,6 +43,7 @@ # use strict; +use POSIX qw/strftime/; use Bweb; use CCircle ; use Digest::MD5 qw(md5_hex); @@ -65,9 +66,7 @@ my $md5_rep = md5_hex("$where:$jobid") ; 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); @@ -80,6 +79,16 @@ 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 (-w $base_fich) { + $bweb->error("$base_fich is not writable"); + exit 0; +} + if (-f "$base_fich/$md5_rep.png" and -f "$base_fich/$md5_rep.tpl") { $bweb->display({}, "$base_fich/$md5_rep.tpl"); @@ -237,8 +246,13 @@ sub fv_get_file_attribute 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 @@ -248,6 +262,9 @@ sub fv_get_file_attribute $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; } @@ -270,7 +287,7 @@ sub fv_get_files_size 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 @@ -286,7 +303,7 @@ sub fv_get_big_files 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 diff --git a/gui/bweb/lang/fr/tpl/display_job_zoom.tpl b/gui/bweb/lang/fr/tpl/display_job_zoom.tpl index 9a52d63ab9..1a21dd59ca 100644 --- a/gui/bweb/lang/fr/tpl/display_job_zoom.tpl +++ b/gui/bweb/lang/fr/tpl/display_job_zoom.tpl @@ -57,7 +57,9 @@ diff --git a/gui/bweb/lang/fr/tpl/fv_file_attribs.tpl b/gui/bweb/lang/fr/tpl/fv_file_attribs.tpl index bb4dd24b2e..f40954ad76 100644 --- a/gui/bweb/lang/fr/tpl/fv_file_attribs.tpl +++ b/gui/bweb/lang/fr/tpl/fv_file_attribs.tpl @@ -1,2 +1,12 @@ -Filename :
-Size :
+
+

Informations sur

+
+
+ + + + + + +
taille :
ctime :
mtime :
atime :
md5 :
+
diff --git a/gui/bweb/script/bweb.conf b/gui/bweb/script/bweb.conf index 7cfa294fcd..8d6e284214 100644 --- a/gui/bweb/script/bweb.conf +++ b/gui/bweb/script/bweb.conf @@ -7,6 +7,14 @@ Require valid-user +Alias /bweb/fv /var/spool/bweb + + Options None + AllowOverride AuthConfig + Order allow,deny + Allow from all + + Alias /bweb /usr/share/bweb/html Options None @@ -14,3 +22,4 @@ Alias /bweb /usr/share/bweb/html Order allow,deny Allow from all + diff --git a/gui/bweb/tpl/display_job_zoom.tpl b/gui/bweb/tpl/display_job_zoom.tpl index b0534e1083..8203ef13ca 100644 --- a/gui/bweb/tpl/display_job_zoom.tpl +++ b/gui/bweb/tpl/display_job_zoom.tpl @@ -51,14 +51,14 @@ -