]> git.nbdom.net Git - nb.git/commitdiff
etc/dbq/data.php
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Sat, 12 Oct 2024 22:27:28 +0000 (00:27 +0200)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Sat, 12 Oct 2024 22:27:28 +0000 (00:27 +0200)
etc/dbq/data.php

index b61f0dde39b750199ad23c62902a0b1eb847faee..08a564e243b6aa45e805cd008ccf4447494d5e5c 100644 (file)
@@ -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']);
 ?>