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 my $latest_personality = $db->selectrow_arrayref(q{
32 select os_version, compiler_version
35 order by effective_date desc limit 1
38 # we don't really need to do this join, since we only want
39 # one row from buildsystems. but it means we only have to run one
40 # query. If it gets heavy we'll split it up and run two
42 my $statement = <<EOS;
44 select (now() at time zone 'GMT')::timestamp(0) - snapshot as when_ago,
45 sysname, snapshot, b.status, stage,
46 operating_system, os_version, compiler, compiler_version, architecture,
48 sys_notes_ts::date AS sys_notes_date, sys_notes
53 and s.status = 'approved'
55 order by snapshot desc
62 my $sth=$db->prepare($statement);
63 $sth->execute($member,$branch);
64 while (my $row = $sth->fetchrow_hashref)
66 $row->{owner_email} =~ s/\@/ [ a t ] /;
67 if ($latest_personality)
69 $row->{os_version} = $latest_personality->[0];
70 $row->{compiler_version} = $latest_personality->[1];
72 push(@$statrows,$row);
79 my $template_opts = { INCLUDE_PATH => $template_dir, EVAL_PERL => 1 };
80 my $template = new Template($template_opts);
82 print "Content-Type: text/html\n\n";
84 $template->process('history.tt',