aboutsummaryrefslogtreecommitdiffstats
path: root/web/api/read/comments
diff options
context:
space:
mode:
authorKristian Lyngstol <kristian@bohemians.org>2016-04-12 18:01:32 +0200
committerKristian Lyngstol <kristian@bohemians.org>2016-04-12 18:01:32 +0200
commit09ea945c3908fd42e90eb64c194d9af11d174206 (patch)
tree8bcf0f98113ea4a92effa1c39344730c7e6f50b0 /web/api/read/comments
parentc3ebdbda43c23ade1e49dfd9f546fba1d15f9941 (diff)
Actual initial import
Fetched from tgmanage.
Diffstat (limited to 'web/api/read/comments')
-rwxr-xr-xweb/api/read/comments15
1 files changed, 15 insertions, 0 deletions
diff --git a/web/api/read/comments b/web/api/read/comments
new file mode 100755
index 0000000..4adfb2b
--- /dev/null
+++ b/web/api/read/comments
@@ -0,0 +1,15 @@
+#! /usr/bin/perl
+# vim:ts=8:sw=8
+
+use lib '../../../../include';
+use nms::web;
+use strict;
+use warnings;
+
+my $query = $nms::web::dbh->prepare('select sysname,extract(epoch from date_trunc(\'second\',time)) as time,state,username,id,comment from switch_comments natural join switches where state != \'delete\' order by time desc');
+$query->execute();
+while (my $ref = $query->fetchrow_hashref()) {
+ push @{$nms::web::json{'comments'}{$ref->{'sysname'}}{'comments'}},$ref;
+}
+
+nms::web::finalize_output();