5 Copyright (c) 2003-2010, Andrew Dunstan
7 See accompanying License file for license details
15 use File::Temp qw(tempfile);
17 use vars qw($dbhost $dbname $dbuser $dbpass $dbport @log_file_names);
20 require "$ENV{BFConfDir}/BuildFarmWeb.pl";
21 #require "BuildFarmWeb.pl";
23 die "no dbname" unless $dbname;
24 die "no dbuser" unless $dbuser;
26 my $dsn="dbi:Pg:dbname=$dbname";
27 $dsn .= ";host=$dbhost" if $dbhost;
28 $dsn .= ";port=$dbport" if $dbport;
32 my $system = $query->param('nm'); $system =~ s/[^a-zA-Z0-9_ -]//g;
33 my $logdate = $query->param('dt');$logdate =~ s/[^a-zA-Z0-9_ -]//g;
34 my $stage = $query->param('stg');$stage =~ s/[^a-zA-Z0-9._ -]//g;
38 if ($system && $logdate && $stage)
40 my $db = DBI->connect($dsn,$dbuser,$dbpass);
42 die $DBI::errstr unless $db;
46 select branch, log_text
48 where sysname = ? and snapshot = ? and log_stage = ? || '.log'
54 my $sth=$db->prepare($statement);
55 $sth->execute($system,$logdate,$stage);
56 my $row=$sth->fetchrow_arrayref;
57 my ($branch, $logtext) = ("unknown","no log text found");
66 print "Content-Type: text/plain\n\n", $logtext,
68 "-------------------------------------------------\n\n",
69 "Hosting for the PostgreSQL Buildfarm is generously ",
70 "provided by: CommandPrompt, The PostgreSQL Company";
76 print "Status: 460 bad parameters\n",
77 "Content-Type: text/plain\n\n";