]> git.nbdom.net Git - nb.git/commitdiff
etc/dbq/data.php
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Sun, 13 Oct 2024 21:44:52 +0000 (23:44 +0200)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Sun, 13 Oct 2024 21:44:52 +0000 (23:44 +0200)
etc/dbq/data.php

index 542fb4f702b8b90a899588ea723b142ddb72913a..e9ef679b0dd27306312ceea51934d572342e2ca1 100644 (file)
@@ -7,20 +7,7 @@ $DBQ['data'] = [
                                                ." OR (key LIKE '%.exit_code' AND val<> '0')"
                                        ,
                        ],
-                       'host_git' => [
-                                       'sql_' => preg_replace('/[\t\r\n]+/',' ',"
-                                               SELECT host,max(CAST(val as INTEGER)) FROM host_info WHERE key LIKE 'git.%exit_code' GROUP BY host
-                                       "),
-                                       'sql_' => preg_replace('/[\t\r\n]+/',' ',"
-                                               SELECT host
-                                                       ,max(updated) as last_updated
-                                                       ,min(updated) as first_updated
-                                                       ,(SELECT count(path.val) FROM host_info path WHERE path.host=hi.host AND path.key LIKE 'git.%.path') as repos
-                                                       ,max(val) as exit
-                                               FROM host_info hi
-                                               WHERE key LIKE 'git.%exit_code'
-                                               GROUP BY host ORDER BY last_updated DESC, host
-                                       "),
+                       'host_info_git' => [
                                        'sql' => preg_replace('/[\t\r\n]/','',"
                                                SELECT host
                                                        ,max(updated) as last_updated
@@ -34,25 +21,6 @@ $DBQ['data'] = [
                                                         GROUP BY host ORDER BY last_updated DESC, host
 "),
                                        'row_parse_pre' => function(&$row,$t) {
-                                               # NB 13.10.24 if ($row['exit'] === null) debug(
-                                                       # NB 13.10.24 $t->db()->row("SELECT max(cast(val as integer)) FROM host_info"
-                                                               # NB 13.10.24 ." WHERE host=".$t->db()->quote($row['host'])
-                                                               # NB 13.10.24 ." AND key like ".$t->db()->quote('%exit_code')
-                                                       # NB 13.10.24 )
-                                               # NB 13.10.24 );
-                                               # NB 13.10.24 if ($row['exit'] === null) $row['exit'] =
-                                                       # NB 13.10.24 $t->db()->row("SELECT max(cast(val as integer)) FROM host_info"
-                                                               # NB 13.10.24 ." WHERE host=".$t->db()->quote($row['host'])
-                                                               # NB 13.10.24 ." AND key like ".$t->db()->quote('%exit_code')
-                                                       # NB 13.10.24 )
-                                               # NB 13.10.24 ;
-                                               # NB 13.10.24 $row['exit'] =
-                                                       # NB 13.10.24 $t->db()->row("SELECT max(val) FROM host_info"
-                                                               # NB 13.10.24 ." WHERE host=".$t->db()->quote($row['host'])
-                                                               # NB 13.10.24 ." AND key like ".$t->db()->quote('git.%exit_code')
-                                                       # NB 13.10.24 )
-                                               # NB 13.10.24 ;
-                                               
                                                foreach ($row as $k=>$v) {
                                                        if (strpos($k,'updated') !== false) {
                                                                $row[$k] = preg_replace('/\..*$/','',$v);