7 use File::Temp qw(tempfile);
9 use vars qw($dbhost $dbname $dbuser $dbpass $dbport @log_file_names);
12 require "$ENV{BFConfDir}/BuildFarmWeb.pl";
13 #require "BuildFarmWeb.pl";
15 die "no dbname" unless $dbname;
16 die "no dbuser" unless $dbuser;
18 my $dsn="dbi:Pg:dbname=$dbname";
19 $dsn .= ";host=$dbhost" if $dbhost;
20 $dsn .= ";port=$dbport" if $dbport;
24 my $system = $query->param('nm'); $system =~ s/[^a-zA-Z0-9_ -]//g;
25 my $logdate = $query->param('dt');$logdate =~ s/[^a-zA-Z0-9_ -]//g;
26 my $stage = $query->param('stg');$stage =~ s/[^a-zA-Z0-9_ -]//g;
30 if ($system && $logdate)
33 my $db = DBI->connect($dsn,$dbuser,$dbpass);
35 die $DBI::errstr unless $db;
41 where sysname = ? and snapshot = ?
47 my $sth=$db->prepare($statement);
48 $sth->execute($system,$logdate);
49 my $row=$sth->fetchrow_arrayref;
60 "Content-Type: application/x-gzip\n",
61 "Content-Disposition: attachment; filename=buildfarmlog.tgz\n",
67 my $template = "buildlogXXXXXX";
68 my ($fh, $filename) = tempfile($template, UNLINK => 1);
72 my $output = `tar -z -O -xf $filename $stage.log 2>&1`;
74 print "Content-Type: text/plain\n\n", $output,
76 "-------------------------------------------------\n\n",
77 "Hosting for the PostgreSQL Buildfarm is generously ",
78 "provided by: CommandPrompt, The PostgreSQL Company";
82 # using <pre> like this on huge files can make browsers choke
84 print "Content-Type: text/html\n\n";