2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-12 02:39:57 +00:00

statistics2.cgi: check $rev for proper value

git-svn-id: https://svn.fhem.de/fhem/trunk@14618 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
markusbloch 2017-07-01 17:01:55 +00:00
parent 686c1a0619
commit eca374e5bd

View File

@ -93,10 +93,12 @@ sub insertDB() {
if (defined($decoded->{'system'}{'revision'})) {
# replace revision number with revision date
my $rev = $decoded->{'system'}{'revision'};
my $d = (split(/ /,qx(sudo -u rko /usr/bin/svn info -r $rev $fhemPathSvn|grep Date:)))[3];
my ($year,$mon,$mday) = split(/-/,$d);
$decoded->{'system'}{'revdate'} = mktime(0,0,7,$mday,($mon-1),($year-1900),0,0,0);
$json = encode_json $decoded;
if($rev =~ /^\d+$/) {
my $d = (split(/ /,qx(sudo -u rko /usr/bin/svn info -r $rev $fhemPathSvn|grep Date:)))[3];
my ($year,$mon,$mday) = split(/-/,$d);
$decoded->{'system'}{'revdate'} = mktime(0,0,7,$mday,($mon-1),($year-1900),0,0,0);
$json = encode_json $decoded;
}
}
$sth = $dbh->prepare(q{INSERT OR REPLACE INTO jsonNodes(uniqueID,geo,json) VALUES(?,?,?)});