/
build.php
86 lines (77 loc) · 3 KB
/
build.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
// Copyright (C) 2015 xaizek <xaizek@posteo.net>
//
// fragile is free software: you can redistribute it and/or modify it under the
// terms of the GNU Affero General Public License as published by the Free
// Software Foundation, version 3.
//
// fragile is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
// A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
// details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
require_once __DIR__ . '/header.php';
require_once __DIR__ . '/classes/Build.php';
require_once __DIR__ . '/classes/Buildset.php';
require_once __DIR__ . '/classes/Utils.php';
if (!isset($_GET['buildset']) || !isset($_GET['buildername'])) {
die("Invalid parameters.\n");
}
$buildsetid = $_GET['buildset'];
$buildername = $_GET['buildername'];
try {
if (($build = Build::get($buildsetid, $buildername)) === null) {
print "<h3>No Such Build</h3>\n";
} elseif (($buildset = Buildset::get($buildsetid)) === null) {
print "<h3>No Such Buildset</h3>\n";
} else {
print "<div class='infobar'>\n";
print "<span class='infocell'>\n";
print "<span class='infotitle'>Buildset:</span>\n";
print htmlentities($buildset->buildsetid);
print "</span>\n";
print "<span class='infocell'>\n";
print "<span class='infotitle'>Builder:</span>\n";
print htmlentities($buildername);
print "</span>\n";
print "<span class='infocell'>\n";
print "<span class='infotitle'>Revision:</span>\n";
print htmlentities($buildset->revision);
print "</span>\n";
print "<span class='infocell'>\n";
print "<span class='infotitle'>Ref:</span>\n";
print htmlentities($buildset->name);
print "</span>\n";
print "<span class='infocell'>\n";
print "<span class='infotitle'>Result:</span>\n";
print htmlentities($build->status);
print "</span>\n";
print "<span class='infocell'>\n";
print "<span class='infotitle'>Exit code:</span>\n";
print htmlentities($build->exitcode);
print "</span>\n";
print "<span class='infocell'>\n";
print "<span class='infotitle'>Duration:</span>\n";
print htmlentities(Utils::formatDuration($build->getDuration()));
print "</span>\n";
print "</div>\n";
$rawOutput = $build->getOutput();
$parts = preg_split('/\n\n/', $rawOutput, 2);
if (!empty($parts[0])) {
print "<hr/>\n";
print "<div class='buildreport'>$parts[0]</div>";
}
if (!empty($parts[1])) {
print "<hr/>\n";
print "<pre>";
print $parts[1];
print "</pre>\n";
}
}
} catch (PDOException $e) {
print "<h3>No Database</h3>\n";
}
require_once __DIR__ . '/footer.php';
?>