10 use vars qw($dbhost $dbname $dbuser $dbpass $dbport $template_dir $sort_by);
13 require "$ENV{BFConfDir}/BuildFarmWeb.pl";
14 #require "BuildFarmWeb.pl";
17 my %sort_ok = ('name' => 'lower(name)' ,
18 'owner' => 'lower(owner_email)',
19 'os' => 'lower(operating_system), os_version',
20 'compiler' => 'lower(compiler), compiler_version' ,
21 'arch' => 'lower(architecture)' );
22 $sort_by = $query->param('sort_by');$sort_by =~ s/[^a-zA-Z0-9_ -]//g;
23 $sort_by = $sort_ok{$sort_by} || $sort_ok{name};
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 # there is possibly some redundancy in this query, but it makes
32 # a lot of the processing simpler.
34 my $statement = <<EOS;
36 select name, operating_system, os_version, compiler, compiler_version, owner_email,
37 architecture as arch, ARRAY(
38 select branch || ':' ||
39 extract(days from now() - latest_snapshot)
40 from build_status_latest l
41 where l.sysname = s.name
42 order by branch <> 'HEAD', branch desc
45 where status = 'approved'
52 my $sth=$db->prepare($statement);
54 while (my $row = $sth->fetchrow_hashref)
56 $row->{branches} =~ s/^\{(.*)\}$/$1/;
57 $row->{owner_email} =~ s/\@/ [ a t ] /;
58 push(@$statrows,$row);
65 # use Data::Dumper; print "Content-Type: text/plain\n\n",Dumper($statrows),"VERSION: ",$DBD::Pg::VERSION,"\n"; exit;
68 my $template_opts = { INCLUDE_PATH => $template_dir};
69 my $template = new Template($template_opts);
71 print "Content-Type: text/html\n\n";
73 $template->process('members.tt',
74 {statrows=>$statrows});