5 Copyright (c) 2003-2010, Andrew Dunstan
7 See accompanying License file for license details
17 use vars qw($dbhost $dbname $dbuser $dbpass $dbport);
19 use FindBin qw($RealBin);
20 require "$RealBin/../BuildFarmWeb.pl";
22 my $dsn="dbi:Pg:dbname=$dbname";
23 $dsn .= ";host=$dbhost" if $dbhost;
24 $dsn .= ";port=$dbport" if $dbport;
26 my $dbh = DBI->connect($dsn,$dbuser,$dbpass) or die("$dsn,$dbuser,$dbpass,$!");
31 select sysname, max(snapshot) as snapshot
33 where branch = 'HEAD' and
34 log_stage = 'typedefs.log' and
35 snapshot > current_date::timestamp - interval '30 days'
38 my $builds = $dbh->selectall_arrayref($sql, { Slice => {} });
41 if ($query->param('show_list'))
43 print "Content-Type: text/html\n\n",
44 "<head><title>Typedefs URLs</title></head>\n",
45 "<body><h1>Typdefs URLs</h1>\n",
46 "<table border='1'><tr><th>member</th></tr>\n";
48 foreach my $build (@$builds)
50 print "<tr><td><a href='http://www.pgbuildfarm.org/cgi-bin/show_stage_log.pl?nm=$build->{sysname}\&dt=$build->{snapshot}\&stg=typedefs'>$build->{sysname}</a></td></tr>\n";
52 print "</table></body></html>\n";
61 and log_stage = 'typedefs.log'
65 my $sth = $dbh->prepare($sql);
67 foreach my $build (@$builds)
69 $sth->execute($build->{sysname},$build->{snapshot});
70 my @row = $sth->fetchrow;
71 my @typedefs = split(/\s+/,$row[0]);
72 @words{@typedefs} = 1 x @typedefs;
75 print "Content-Type: text/plain\n\n",
76 join("\n",sort keys %words),