2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 18:59:33 +00:00

statistics2.cgi: only count official modules

git-svn-id: https://svn.fhem.de/fhem/trunk@25084 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
betateilchen 2021-10-16 13:16:33 +00:00
parent 5e3ad45a28
commit bad6417b99

View File

@ -39,6 +39,8 @@ use Geo::IP;
sub insertDB(); sub insertDB();
sub getLocation(); sub getLocation();
sub revInfo($);
sub makeOfficial();
sub add2total(); sub add2total();
sub doAggregate(); sub doAggregate();
sub viewStatistics(); sub viewStatistics();
@ -88,6 +90,7 @@ sub insertDB() {
my $decoded = decode_json($json); my $decoded = decode_json($json);
$json = revInfo($decoded) if (defined($decoded->{'system'}{'revision'})); $json = revInfo($decoded) if (defined($decoded->{'system'}{'revision'}));
makeOfficial(); # delete inofficial modules from statistics data
$dbh = DBI->connect($dsn,"","", { RaiseError => 1, ShowErrorStatement => 1 }) || $dbh = DBI->connect($dsn,"","", { RaiseError => 1, ShowErrorStatement => 1 }) ||
die "Cannot connect: $DBI::errstr"; die "Cannot connect: $DBI::errstr";
@ -137,6 +140,15 @@ sub revInfo($) {
} }
} }
sub makeOfficial() {
my %official = ();
open (FH, "$fhemPathSvn/controls_fhem.txt") || die "Sorry!!";
while (<FH>) { $official{$1} = 1 if ($_ =~ /FHEM\/\d\d_(.*)\.pm/) }
close FH;
foreach my $key (keys %$decoded) { delete $decoded->{$key} unless $official{$key} }
return;
}
sub add2total() { sub add2total() {
my $today = strftime("%Y-%m-%d", localtime); my $today = strftime("%Y-%m-%d", localtime);