diff options
author | Magnus Kirø <magnuskiro@gmail.com> | 2016-03-20 21:49:15 +0100 |
---|---|---|
committer | Magnus Kirø <magnuskiro@gmail.com> | 2016-03-20 21:49:15 +0100 |
commit | 11fc373807b9a14ee14499165b00f5e775d11a59 (patch) | |
tree | 4ae6c14a11af0cf23cf87b47885f7271f6b7fa52 | |
parent | 7aa3e646034edae269dfcc41512f101424d9b999 (diff) |
which switch an I on script file.
-rwxr-xr-x | web/nms.gathering.org/api/private/which-switch-am-i-on | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/web/nms.gathering.org/api/private/which-switch-am-i-on b/web/nms.gathering.org/api/private/which-switch-am-i-on new file mode 100755 index 0000000..4adfb2b --- /dev/null +++ b/web/nms.gathering.org/api/private/which-switch-am-i-on @@ -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(); |