summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--modules-available/statistics/api.inc.php11
-rw-r--r--modules-available/statistics/install.inc.php11
-rw-r--r--modules-available/statistics/lang/de/template-tags.json1
-rw-r--r--modules-available/statistics/lang/en/template-tags.json1
-rw-r--r--modules-available/statistics/pages/machine.inc.php2
-rw-r--r--modules-available/statistics/templates/machine-main.html25
6 files changed, 40 insertions, 11 deletions
diff --git a/modules-available/statistics/api.inc.php b/modules-available/statistics/api.inc.php
index c3d7f17c..f0996cca 100644
--- a/modules-available/statistics/api.inc.php
+++ b/modules-available/statistics/api.inc.php
@@ -96,15 +96,18 @@ if ($type[0] === '~') {
'data' => $data,
'state' => 'IDLE',
);
+ $firmware = substr(Request::post('firmware', '', 'string'), 0, 4);
// Create/update machine entry
if ($old === false) {
$new['firstseen'] = $NOW;
$new['hostname'] = $hostname;
+ $new['firmware'] = $firmware;
$res = Database::exec('INSERT INTO machine '
. '(machineuuid, macaddr, clientip, firstseen, lastseen, logintime, position, lastboot, realcores, mbram,'
- . ' kvmstate, cpumodel, systemmodel, id44mb, badsectors, data, hostname, state) VALUES '
+ . ' kvmstate, cpumodel, systemmodel, id44mb, badsectors, data, hostname, state, firmware) VALUES '
. "(:machineuuid, :macaddr, :clientip, :firstseen, :lastseen, 0, '', :lastboot, :realcores, :mbram,"
- . ' :kvmstate, :cpumodel, :systemmodel, :id44mb, :badsectors, :data, :hostname, :state)', $new, true);
+ . ' :kvmstate, :cpumodel, :systemmodel, :id44mb, :badsectors, :data, :hostname, :state, :firmware)',
+ $new, true);
if ($res === false) {
die("Concurrent insert, ignored. (RESULT=0)\n");
}
@@ -119,6 +122,10 @@ if ($type[0] === '~') {
$new['currentrunmode'] = Util::cleanUtf8($runmode);
$moresql .= ' currentrunmode = :currentrunmode,';
}
+ if (!empty($firmware)) {
+ $new['firmware'] = Util::cleanUtf8($firmware);
+ $moresql .= ' firmware = :firmware,';
+ }
$new['oldstate'] = $old['state'];
$new['oldlastseen'] = $old['lastseen'];
$res = Database::exec('UPDATE machine SET '
diff --git a/modules-available/statistics/install.inc.php b/modules-available/statistics/install.inc.php
index bc8a5c91..e9d7e9cb 100644
--- a/modules-available/statistics/install.inc.php
+++ b/modules-available/statistics/install.inc.php
@@ -47,6 +47,7 @@ $res[] = tableCreate('machine', "
`hostname` varchar(200) NOT NULL DEFAULT '',
`currentsession` varchar(120) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
`currentuser` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
+ `firmware` varchar(4) CHARACTER SET ascii NOT NULL DEFAULT '',
`notes` text,
PRIMARY KEY (`machineuuid`),
KEY `macaddr` (`macaddr`),
@@ -367,5 +368,15 @@ if (stripos(tableColumnType('statistic', 'data'), 'blob') === false) {
$res[] = UPDATE_DONE;
}
+// 2024-12-16: Add firmware column
+if (!tableHasColumn('machine', 'firmware')) {
+ $ret = Database::exec("ALTER TABLE `machine`
+ ADD COLUMN `firmware` varchar(4) CHARACTER SET ascii NOT NULL DEFAULT ''");
+ if ($ret === false) {
+ finalResponse(UPDATE_FAILED, 'Adding firmware column to machine table failed: ' . Database::lastError());
+ }
+ $res[] = UPDATE_DONE;
+}
+
// Create response
responseFromArray($res);
diff --git a/modules-available/statistics/lang/de/template-tags.json b/modules-available/statistics/lang/de/template-tags.json
index 9149deb7..e22dc651 100644
--- a/modules-available/statistics/lang/de/template-tags.json
+++ b/modules-available/statistics/lang/de/template-tags.json
@@ -26,6 +26,7 @@
"lang_duration": "Dauer",
"lang_event": "Ereignis",
"lang_eventType": "Typ",
+ "lang_firmware": "Firmware",
"lang_firstSeen": "Erste Aktivit\u00e4t",
"lang_free": "frei",
"lang_fullInfo": "Alle Werte",
diff --git a/modules-available/statistics/lang/en/template-tags.json b/modules-available/statistics/lang/en/template-tags.json
index 4afcfed2..6f474c52 100644
--- a/modules-available/statistics/lang/en/template-tags.json
+++ b/modules-available/statistics/lang/en/template-tags.json
@@ -26,6 +26,7 @@
"lang_duration": "Duration",
"lang_event": "Event",
"lang_eventType": "Type",
+ "lang_firmware": "Firmware",
"lang_firstSeen": "First seen",
"lang_free": "free",
"lang_fullInfo": "All values",
diff --git a/modules-available/statistics/pages/machine.inc.php b/modules-available/statistics/pages/machine.inc.php
index aeb5519c..1fc9efd8 100644
--- a/modules-available/statistics/pages/machine.inc.php
+++ b/modules-available/statistics/pages/machine.inc.php
@@ -56,7 +56,7 @@ class SubPage
$client = Database::queryFirst('SELECT machineuuid, locationid, macaddr, clientip, firstseen, lastseen, logintime, lastboot, state,
mbram, live_tmpsize, live_tmpfree, live_id45size, live_id45free, live_swapsize, live_swapfree,
live_memsize, live_memfree, live_cpuload, live_cputemp,
- Length(position) AS hasroomplan, kvmstate, cpumodel, id44mb, id45mb, data, hostname, currentuser, currentsession, notes
+ Length(position) AS hasroomplan, kvmstate, cpumodel, id44mb, id45mb, data, hostname, currentuser, currentsession, notes, firmware
FROM machine WHERE machineuuid = :uuid',
array('uuid' => $uuid));
if ($client === false) {
diff --git a/modules-available/statistics/templates/machine-main.html b/modules-available/statistics/templates/machine-main.html
index 64b8565c..385f4857 100644
--- a/modules-available/statistics/templates/machine-main.html
+++ b/modules-available/statistics/templates/machine-main.html
@@ -55,14 +55,6 @@
<td class="text-nowrap">{{lang_lastBoot}}</td>
<td>
{{lastboot_s}}
- {{#minilinux}}
- <div>
- {{lang_baseSystem}}: <a href="?do=minilinux#{{minilinux}}">{{minilinux}}</a>
- {{#boottime_s}}
- (<span title="{{lang_boottimeTooltip}}">{{boottime_s}}</span>)
- {{/boottime_s}}
- </div>
- {{/minilinux}}
</td>
</tr>
<tr>
@@ -110,6 +102,23 @@
</td>
</tr>
{{/modeid}}
+ {{#minilinux}}
+ <tr>
+ <td class="text-nowrap">{{lang_baseSystem}}</td>
+ <td>
+ <a href="?do=minilinux#{{minilinux}}">{{minilinux}}</a>
+ {{#boottime_s}}
+ (<span title="{{lang_boottimeTooltip}}">{{boottime_s}}</span>)
+ {{/boottime_s}}
+ </td>
+ </tr>
+ {{/minilinux}}
+ {{#firmware}}
+ <tr>
+ <td class="text-nowrap">{{lang_firmware}}</td>
+ <td>{{firmware}}</td>
+ </tr>
+ {{/firmware}}
{{#roomsvg}}
<tr>
<td class="text-nowrap">