<?php /* -*- Mode: PHP; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set sw=2 ts=2 et tw=80 : */ require_once 'config.php'; require_once 'inc/Communication.php'; Headers::send(Headers::ALLOW_CROSS_ORIGIN, "application/json"); $id = requireStringParameter('id', $_POST); if (is_numeric($id)) { // $id is a Buildbot ID. $stmt = $db->prepare("\n SELECT id\n FROM runs\n WHERE buildbot_id = :id;"); $stmt->execute(array(":id" => $id)); $run = $stmt->fetchColumn(); if (!$run) { die("No build with that id in database."); } } else { // $id is not a Buildbot ID; it could be a Tinderbox result ID. // TBPL with Tinderbox backend doesn't know the Buildbot ID of a run, // so it lets us figure it out from the slave name and the start time // of the run. $slave = requireStringParameter('machinename', $_POST); $starttime = +requireStringParameter('starttime', $_POST); $stmt = $db->prepare("\n SELECT id\n FROM runs\n WHERE slave = :slave AND starttime = FROM_UNIXTIME(:starttime);"); $stmt->execute(array(":slave" => $slave, ":starttime" => $starttime)); $run = $stmt->fetchColumn(); if (!$run) { die("No build with that slave/starttime combination in database."); } } $who = requireStringParameter('who', $_POST);
<?php /* -*- Mode: PHP; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set sw=2 ts=2 et tw=80 : */ // Returns all builders belonging to a branch with the following format: // [ { "name": "...", "buildername": "...", "hidden": 0/1 }, ... ] // hidden:0 may be ommitted. require_once 'config.php'; require_once 'inc/Communication.php'; Headers::send(Headers::ALLOW_CROSS_ORIGIN | Headers::NO_CACHE, "application/json"); $branch = requireStringParameter('branch', $_GET); $stmt = $db->prepare("\n SELECT name, buildername, hidden\n FROM builders\n WHERE branch = :branch\n ORDER BY buildername ASC;"); $stmt->execute(array(":branch" => $branch)); // mysql returns everything as string, so we need to manually cast to bool :-( $result = array(); while ($builder = $stmt->fetch(PDO::FETCH_ASSOC)) { $builder['hidden'] = $builder['hidden'] != "0"; $result[] = $builder; } echo json_encode($result) . "\n";
<?php /* -*- Mode: PHP; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set sw=2 ts=2 et tw=80 : */ require_once 'inc/LogParser.php'; require_once 'inc/GeneralErrorFilter.php'; require_once 'inc/ShortLogGenerator.php'; require_once 'inc/FullLogGenerator.php'; require_once 'inc/GzipUtils.php'; require_once 'inc/RunForLog.php'; require_once 'inc/Communication.php'; Headers::send(Headers::ALLOW_CROSS_ORIGIN); $run = getRequestedRun(); $logParser = new LogParser($run, new GeneralErrorFilter()); try { // Create the plain text summary too, since we need to parse the // log for errors anyway. $logParser->ensureExcerptExists(); $viewFullLog = isset($_GET['full']) && $_GET['full'] == 1; $logGenerator = $viewFullLog ? new FullLogGenerator($logParser, $run) : new ShortLogGenerator($logParser, $run); $parsedLog = $logGenerator->ensureLogExists(); GzipUtils::passThru($parsedLog, "text/html"); } catch (Exception $e) { die($e->getMessage()); }