summaryrefslogtreecommitdiff
path: root/buildmaster/build-log.php
blob: 89655e4040f5e20a26b0c79ba5d83b080e99b27f (plain)
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
<?php
require_once "../init.php";

require_once BASE . "/lib/http.php";
require_once BASE . "/lib/helper.php";
require_once BASE . "/lib/mysql.php";

abort_iff_webspider();

$extra_joins = '';
$filter = 'WHERE 1';

if (array_key_exists('a', $_GET)) {
  $extra_joins .= mysql_join_build_assignments_architectures();
  $filter .= ' AND `architectures`.`name`=from_base64("' . base64_encode($_GET['a']) . '")';
}

if (array_key_exists('p', $_GET)) {
  $extra_joins .= mysql_join_build_assignments_package_sources();
  $filter .= ' AND `package_sources`.`pkgbase`=from_base64("' . base64_encode($_GET['p']) . '")';
}

$result = mysql_run_query(
  'SELECT `failed_builds`.`log_file` FROM `failed_builds`' .
  mysql_join_failed_builds_build_assignments() .
  $extra_joins .
  $filter .
  ' ORDER BY `failed_builds`.`date` DESC' .
  ' LIMIT 1'
);

if ($result -> num_rows != 1)
  throw_http_error(404, 'Not Found', 'No logs found in the mysql database for this package.');

$result = $result -> fetch_assoc();

redirect_temporarily('https://buildmaster.archlinux32.org/build-logs/error/' . $result['log_file']);