get log text from build_status_log table
authorAndrew Dunstan <andrew@dunslane.net>
Mon, 27 Aug 2007 16:50:30 +0000 (16:50 +0000)
committerAndrew Dunstan <andrew@dunslane.net>
Mon, 27 Aug 2007 16:50:30 +0000 (16:50 +0000)
cgi-bin/show_stage_log.pl

index dbc364925c7b001cca1c11144dfed1501f1a9940..5dd1ae43fb5c378781f7e87d1422ea64c6e15872 100755 (executable)
@@ -27,6 +27,51 @@ my $stage = $query->param('stg');$stage =~ s/[^a-zA-Z0-9_ -]//g;
 
 use vars qw($tgz);
 
+if ($system && $logdate && $stage)
+{
+    my $db = DBI->connect($dsn,$dbuser,$dbpass);
+
+    die $DBI::errstr unless $db;
+
+    my $statement = q(
+
+        select branch, log_text
+        from build_status_log
+        where sysname = ? and snapshot = ? and log_stage = ? || '.log'
+
+        );
+
+
+    
+    my $sth=$db->prepare($statement);
+    $sth->execute($system,$logdate,$stage);
+    my $row=$sth->fetchrow_arrayref;
+    my ($branch, $logtext) = ("unknown","no log text found");
+    if ($row)
+    {
+        $branch = $row->[0];
+        $logtext =$row->[1];
+    }
+    $sth->finish;
+    $db->disconnect;
+
+    print "Content-Type: text/plain\n\n", $logtext,
+
+    "-------------------------------------------------\n\n",
+    "Hosting for the PostgreSQL Buildfarm is generously ",
+    "provided by: CommandPrompt, The PostgreSQL Company";
+
+    exit;
+
+}
+
+else 
+{
+    print "Status: 460 bad parameters\n",
+    "Content-Type: text/plain\n\n";
+    exit;
+}
+
 if ($system && $logdate)
 {