summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2022-07-20 14:42:14 +0200
committerErich Eckner <git@eckner.net>2022-07-20 14:42:14 +0200
commita98d2bc96cf6c65532c8e1139ef4fc7124021965 (patch)
treeff23383dfd6d8c0f4802a530d94df8bd097cfd64
parent9c9a42d5ab08ef70a0a43b2f9f323f35e65b6771 (diff)
downloadcolocation-a98d2bc96cf6c65532c8e1139ef4fc7124021965.tar.xz
update.php: set timestamp
-rw-r--r--html/update.php11
1 files changed, 11 insertions, 0 deletions
diff --git a/html/update.php b/html/update.php
index 39e8d64..7c4d394 100644
--- a/html/update.php
+++ b/html/update.php
@@ -14,6 +14,7 @@ include "db.php";
$stm = $db -> prepare(
'SELECT' .
+ ' machines.id as machine_id,' .
' upd_values.id as value_id,' .
' IIF(upd_values.state_id <= "values".state_id, 1, 0) as downgrade,' .
' IIF(upd_values.state_id >= "values".state_id, 1, 0) as upgrade,' .
@@ -39,6 +40,12 @@ $updstm = $db -> prepare(
' AND ("values".value != :global_value OR "values".value IS NULL)'
);
+$updmstm = $db -> prepare(
+ 'UPDATE machines' .
+ ' SET last_update = datetime(' . "'now'" . ')' .
+ ' WHERE machines.id = :machine'
+);
+
while ($row = $result -> fetchArray()) {
if (! array_key_exists($row['state'], $_GET))
continue;
@@ -60,8 +67,12 @@ while ($row = $result -> fetchArray()) {
$updstm -> bindValue('global_value', $value);
$updstm -> bindValue('value_id', $row['value_id']);
$updstm -> execute();
+ $updmstm -> bindValue('machine', $row['machine_id']);
+ $updmstm -> execute();
}
$stm -> close();
+$updstm -> close();
+$updmstm -> close();
echo 'ok' . "\n";