From 70549777dddc394b40184628ae832dbca21a0b1b Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Tue, 22 Sep 2009 14:44:59 +0200 Subject: [PATCH] bweb: Fix float usage for LIMIT sql query --- gui/bweb/cgi/bfileview.pl | 1 + gui/bweb/cgi/bresto.pl | 5 ++--- gui/bweb/lib/Bweb.pm | 17 ++++++++++------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/gui/bweb/cgi/bfileview.pl b/gui/bweb/cgi/bfileview.pl index d5bc6a2fe7..8282f278ca 100755 --- a/gui/bweb/cgi/bfileview.pl +++ b/gui/bweb/cgi/bfileview.pl @@ -370,6 +370,7 @@ sub fv_get_files_size sub fv_get_big_files { my ($jobid, $rep, $min, $limit) = @_; + $limit = int($limit); my $ret = $bweb->dbh_selectall_arrayref(" SELECT FilenameId AS filenameid, Name AS name, size diff --git a/gui/bweb/cgi/bresto.pl b/gui/bweb/cgi/bresto.pl index 51c2bb0893..a0b217cb42 100755 --- a/gui/bweb/cgi/bresto.pl +++ b/gui/bweb/cgi/bresto.pl @@ -1103,10 +1103,9 @@ if ($action eq 'list_files_dirs') { "'$jids'", # jobid "'" . escape_quote($_->[1]) . "'", # name "'" . $p[7] . "'", # size - "'" . strftime('%Y-%m-%d %H:%m:%S', localtime($p[11])) . "'") . + "'" . strftime('%Y-%m-%d %H:%m:%S', localtime($p[11]||0)) . "'") . ']'; } @$files); - print "," if (@$files); $files = $bvfs->ls_dirs(); @@ -1120,7 +1119,7 @@ if ($action eq 'list_files_dirs') { "'$jids'", # jobid "'" . escape_quote($_->[1]) . "'", # name "'" . $p[7] . "'", # size - "'" . strftime('%Y-%m-%d %H:%m:%S', localtime($p[11])) . "'") . + "'" . strftime('%Y-%m-%d %H:%m:%S', localtime($p[11]||0)) . "'") . ']'; } @$files); diff --git a/gui/bweb/lib/Bweb.pm b/gui/bweb/lib/Bweb.pm index 6b9212cd99..d212372143 100644 --- a/gui/bweb/lib/Bweb.pm +++ b/gui/bweb/lib/Bweb.pm @@ -4670,17 +4670,20 @@ sub add_media $self->display($arg, 'add_media.tpl'); return 1; } - - my $cmd; + $b->connect(); + $b->send("add pool=\"$arg->{pool}\" storage=\"$arg->{storage}\"\n"); if ($arg->{nb} > 0) { $arg->{offset} = $arg->{offset}?$arg->{offset}:1; - $cmd = "add pool=\"$arg->{pool}\" storage=\"$arg->{storage}\"\n$arg->{nb}\n$arg->{media}\n$arg->{offset}\n"; + $b->send("$arg->{nb}\n"); + $b->send("$arg->{media}\n"); + $b->send("$arg->{offset}\n"); + } else { - $cmd = "add pool=\"$arg->{pool}\" storage=\"$arg->{storage}\"\n0\n$arg->{media}\n"; + $b->send("0\n"); + $b->send("$arg->{media}\n"); } - $b->connect(); - $b->send($cmd); - $b->expect_it('*'); + + $b->expect_it('-re','^[*]'); CGI::param('media', ''); CGI::param('re_media', $arg->{media}); -- 2.39.5