8 use vars qw($dbhost $dbname $dbuser $dbpass $dbport $template_dir);
11 require "$ENV{BFConfDir}/BuildFarmWeb.pl";
12 #require "BuildFarmWeb.pl";
14 die "no dbname" unless $dbname;
15 die "no dbuser" unless $dbuser;
17 my $dsn="dbi:Pg:dbname=$dbname";
18 $dsn .= ";host=$dbhost" if $dbhost;
19 $dsn .= ";port=$dbport" if $dbport;
21 my $db = DBI->connect($dsn,$dbuser,$dbpass);
23 die $DBI::errstr unless $db;
26 my $member = $query->param('nm'); $member =~ s/[^a-zA-Z0-9_ -]//g;
27 my $branch = $query->param('br'); $branch =~ s/[^a-zA-Z0-9_ -]//g;
28 my $hm = $query->param('hm'); $hm =~ s/[^a-zA-Z0-9_ -]//g;
29 $hm = '240' unless $hm =~ /^\d+$/;
31 # we don't really need to do this join, since we only want
32 # one row from buildsystems. but it means we only have to run one
33 # query. If it gets heavy we'll split it up and run two
35 my $statement = <<EOS;
37 select (now() at time zone 'GMT')::timestamp(0) - snapshot as when_ago,
38 sysname, snapshot, b.status, stage,
39 operating_system, os_version, compiler, compiler_version, architecture,
45 and s.status = 'approved'
47 order by snapshot desc
54 my $sth=$db->prepare($statement);
55 $sth->execute($member,$branch);
56 while (my $row = $sth->fetchrow_hashref)
58 $row->{owner_email} =~ s/\@/ [ a t ] /;
59 push(@$statrows,$row);
65 my $template_opts = { INCLUDE_PATH => $template_dir, EVAL_PERL => 1 };
66 my $template = new Template($template_opts);
68 print "Content-Type: text/html\n\n";
70 $template->process('history.tt',