5 Copyright (c) 2003-2010, Andrew Dunstan
7 See accompanying License file for license details
16 use vars qw($dbhost $dbname $dbuser $dbpass $dbport $template_dir);
19 require "$ENV{BFConfDir}/BuildFarmWeb.pl";
20 #require "BuildFarmWeb.pl";
22 die "no dbname" unless $dbname;
23 die "no dbuser" unless $dbuser;
25 my $dsn="dbi:Pg:dbname=$dbname";
26 $dsn .= ";host=$dbhost" if $dbhost;
27 $dsn .= ";port=$dbport" if $dbport;
29 my $db = DBI->connect($dsn,$dbuser,$dbpass);
31 die $DBI::errstr unless $db;
34 my $member = $query->param('nm'); $member =~ s/[^a-zA-Z0-9_ -]//g;
35 my $branch = $query->param('br'); $branch =~ s/[^a-zA-Z0-9_ -]//g;
36 my $hm = $query->param('hm'); $hm =~ s/[^a-zA-Z0-9_ -]//g;
37 $hm = '240' unless $hm =~ /^\d+$/;
39 my $latest_personality = $db->selectrow_arrayref(q{
40 select os_version, compiler_version
43 order by effective_date desc limit 1
47 select operating_system, os_version, compiler, compiler_version, architecture,
48 owner_email, sys_notes_ts::date AS sys_notes_date, sys_notes
50 where b.status = 'approved'
57 from build_status_recent_500
61 select (now() at time zone 'GMT')::timestamp(0) - snapshot as when_ago,
62 sysname, snapshot, status, stage
64 order by snapshot desc
69 my $sth = $db->prepare($systemdata);
70 $sth->execute($member);
71 my $sysrow = $sth->fetchrow_hashref;
73 $sth=$db->prepare($statement);
74 $sth->execute($member,$branch);
75 while (my $row = $sth->fetchrow_hashref)
78 while (my($k,$v) = each %$sysrow) { $row->{$k} = $v; }
79 $row->{owner_email} =~ s/\@/ [ a t ] /;
80 if ($latest_personality)
82 $row->{os_version} = $latest_personality->[0];
83 $row->{compiler_version} = $latest_personality->[1];
85 push(@$statrows,$row);
92 my $template_opts = { INCLUDE_PATH => $template_dir, EVAL_PERL => 1 };
93 my $template = new Template($template_opts);
95 print "Content-Type: text/html\n\n";
97 $template->process('history.tt',