From 4767e184bc8186eef47248790d4af43054cdab37 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 18 Apr 2018 10:18:35 +0200 Subject: buildmaster/ssh-log.php -> buildmaster/log.php --- buildmaster/log.php | 85 +++++++++++++++++++++++++++++++++++++++++++++++++ buildmaster/ssh-log.php | 61 ----------------------------------- 2 files changed, 85 insertions(+), 61 deletions(-) create mode 100644 buildmaster/log.php delete mode 100644 buildmaster/ssh-log.php 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 @@ + "`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); + +?> + + + <?php print $to_show; ?>-log + + + + + + $column) { + print " \n"; + } +?> + + fetch_assoc()) { + print " \n"; + foreach ($row as $val) { + print " \n"; + } + print " \n"; + } + +?> +
\n"; + print " " . $label . "\n"; + print "
\n"; + print " " . $val . "\n"; + print "
+ + 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 @@ - - - - ssh-log - - - - - - - - - - - fetch_assoc()) { - print " \n"; - foreach ($row as $val) { - print " \n"; - } - print " \n"; - } - -?> -
- date - - build slave - - action - - parameters -
\n"; - print " " . $val . "\n"; - print "
- - -- cgit v1.2.3-54-g00ecf