statistics2.cgi: check $rev for proper value

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

View File

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