8 use vars qw($dbhost $dbname $dbuser $dbpass $dbport);
11 require "$ENV{BFConfDir}/BuildFarmWeb.pl";
14 my @members = $query->param('member');
16 my $dsn="dbi:Pg:dbname=$dbname";
17 $dsn .= ";host=$dbhost" if $dbhost;
18 $dsn .= ";port=$dbport" if $dbport;
20 my $db = DBI->connect($dsn,$dbuser,$dbpass) or die("$dsn,$dbuser,$dbpass,$!");
22 # there is possibly some redundancy in this query, but it makes
23 # a lot of the processing simpler.
25 my $statement = <<EOS;
27 select (now() at time zone 'GMT')::timestamp(0) - snapshot as when_ago,
28 sysname, snapshot, b.status, stage, branch,
29 operating_system, os_version, compiler, compiler_version, architecture
31 build_status b natural join
32 (select sysname, branch, max(snapshot) as snapshot
34 group by sysname, branch
35 having max(snapshot) > now() - '30 days'::interval
38 and s.status = 'approved'
39 order by case when branch = 'HEAD' then 0 else 1 end,
47 my $sth=$db->prepare($statement);
49 while (my $row = $sth->fetchrow_hashref)
51 next if (@members && ! grep {$_ eq $row->{sysname} } @members);
52 push(@$statrows,$row);
59 my $template = new Template({INCLUDE_PATH=>"/home/community/pgbuildfarm/templates"});
61 print "Content-Type: text/html\n\n";
63 $template->process("dyn/status.tt",{statrows=>$statrows});