Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/buildmaster
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-04-18 10:18:35 +0200
committerErich Eckner <git@eckner.net>2018-04-18 10:18:35 +0200
commit4767e184bc8186eef47248790d4af43054cdab37 (patch)
treea188e2137fa4a90fb92836742e3bc33424d4d55a /buildmaster
parent7607fb8bee300c9196df79188e8dea4dd1a315c1 (diff)
buildmaster/ssh-log.php -> buildmaster/log.php
Diffstat (limited to 'buildmaster')
-rw-r--r--buildmaster/log.php85
-rw-r--r--buildmaster/ssh-log.php61
2 files changed, 85 insertions, 61 deletions
diff --git a/buildmaster/log.php b/buildmaster/log.php
new file mode 100644
index 0000000..911a52a
--- /dev/null
+++ b/buildmaster/log.php
@@ -0,0 +1,85 @@
+<?php
+
+ include "lib/mysql.php";
+
+ if (isset($_GET["show"]) &&
+ ($_GET["show"] == "ssh")) {
+ $to_show = "ssh";
+ $columns = array(
+ "date" => "`ssh_log`.`date`",
+ "build slave" => "`build_slaves`.`name`",
+ "action" => "`ssh_log`.`action`",
+ "parameters" => "`ssh_log`.`parameters`"
+ );
+ $join = " LEFT JOIN `build_slaves` ON `ssh_log`.`build_slave`=`build_slaves`.`id`";
+ } else {
+ $to_show = "email";
+ $columns = array(
+ "date" => "`email_log`.`date`",
+ "action" => "`email_actions`.`name`",
+ "count" => "`email_log`.`count`",
+ "success" => "`email_log`.`success`",
+ "person" => "`persons`.`name`",
+ "comment" => "`email_log`.`comment`"
+ );
+ $join =
+ " LEFT JOIN `email_actions` ON `email_log`.`action`=`email_actions`.`id`" .
+ " LEFT JOIN (`gpg_keys`" .
+ " JOIN `persons` ON `gpg_keys`.`owner`=`persons`.`id`" .
+ ") ON `email_log`.`gpg_key`=`gpg_keys`.`id`";
+ }
+
+ if (isset($_GET["from"]))
+ $min_time = $_GET["from"];
+ elseif ($to_show == "email")
+ $min_time = "1 00:00:00";
+ else
+ $min_time = "00:42:00";
+
+ $query = "SELECT ";
+ foreach ($columns as $name => $column)
+ $query .= $column . " AS `".$name."`,";
+
+ $query = substr($query,0,-1);
+ $query .= " FROM `" . $to_show . "_log`" . $join .
+ " WHERE TIMEDIFF((" .
+ // NOW() is wrong here - due to differing time zones O.o
+ "SELECT MAX(`l`.`date`) FROM `" . $to_show . "_log` AS `l`" .
+ "),`" . $to_show . "_log`.`date`) < from_base64(\"" . base64_encode( $min_time ) . "\")" .
+ " ORDER BY `" . $to_show . "_log`.`date` DESC";
+
+ $result = mysql_run_query($query);
+
+?>
+<html>
+ <head>
+ <title><?php print $to_show; ?>-log</title>
+ <link rel="stylesheet" type="text/css" href="/static/style.css">
+ </head>
+ <body>
+ <table>
+ <tr>
+<?php
+ foreach ($columns as $label => $column) {
+ print " <th>\n";
+ print " " . $label . "\n";
+ print " </th>\n";
+ }
+?>
+ </tr>
+<?php
+
+ while ($row = $result -> fetch_assoc()) {
+ print " <tr>\n";
+ foreach ($row as $val) {
+ print " <td>\n";
+ print " " . $val . "\n";
+ print " </td>\n";
+ }
+ print " </tr>\n";
+ }
+
+?>
+ </table>
+ </body>
+</html>
diff --git a/buildmaster/ssh-log.php b/buildmaster/ssh-log.php
deleted file mode 100644
index 505cf22..0000000
--- a/buildmaster/ssh-log.php
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-
- include "lib/mysql.php";
-
- if (isset($_GET["from"]))
- $min_time = $_GET["from"];
- else
- $min_time = "00:42:00";
-
- $result = mysql_run_query(
- "SELECT `ssh_log`.`date`," .
- "`build_slaves`.`name`," .
- "`ssh_log`.`action`," .
- "`ssh_log`.`parameters`" .
- " FROM `ssh_log`" .
- " JOIN `build_slaves` ON `ssh_log`.`build_slave`=`build_slaves`.`id`" .
- " WHERE TIMEDIFF((" .
- // NOW() is wrong here - due to differing time zones O.o
- "SELECT MAX(`l`.`date`) FROM `ssh_log` AS `l`" .
- "),`ssh_log`.`date`) < from_base64(\"" . base64_encode( $min_time ) . "\")" .
- " ORDER BY `ssh_log`.`date` DESC"
- );
-
-?>
-<html>
- <head>
- <title>ssh-log</title>
- <link rel="stylesheet" type="text/css" href="/static/style.css">
- </head>
- <body>
- <table>
- <tr>
- <th>
- date
- </th>
- <th>
- build slave
- </th>
- <th>
- action
- </th>
- <th>
- parameters
- </th>
- </tr>
-<?php
-
- while ($row = $result -> fetch_assoc()) {
- print " <tr>\n";
- foreach ($row as $val) {
- print " <td>\n";
- print " " . $val . "\n";
- print " </td>\n";
- }
- print " </tr>\n";
- }
-
-?>
- </table>
- </body>
-</html>