From d3ba7b50b6fd809973a1173728a1e7f56f59af5e Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Sun, 13 Oct 2024 00:27:28 +0200 Subject: [PATCH] etc/dbq/data.php --- etc/dbq/data.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/etc/dbq/data.php b/etc/dbq/data.php index b61f0dde..08a564e2 100644 --- a/etc/dbq/data.php +++ b/etc/dbq/data.php @@ -6,7 +6,25 @@ $DBQ['data'] = [ 'sql' => "SELECT * FROM host_info WHERE 0=1" ." OR (key LIKE '%.exit_code' AND val<> '0')" , - ] + ], + 'host_git' => [ + 'sql' => "SELECT host" + .",max(updated) as last_updated" + .",min(updated) as first_updated" + .",(SELECT count(val) FROM host_info path WHERE path.host=hi.host AND path.key LIKE '%.path') as repos" + .",max((SELECT DISTINCT val FROM host_info ex WHERE ex.host=hi.host AND ex.key LIKE '%.exit_code')) as exit" + ." FROM host_info hi" + ." GROUP BY host ORDER BY host" + , + 'row_parse_pre' => function(&$row) { + foreach ($row as $k=>$v) { + if (strpos($k,'updated') !== false) { + $row[$k] = preg_replace('/\..*$/','',$v); + } + } + }, + ], ], ]; +#bye($DBQ['data']['tables']['host_git']['sql']); ?> -- 2.47.3