2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 09:16:53 +00:00

fhem.pl: version diff (Forum #41726)

git-svn-id: https://svn.fhem.de/fhem/trunk@9355 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2015-10-03 13:38:48 +00:00
parent e38aa22d3b
commit 125d02108a

View File

@ -2632,10 +2632,16 @@ CommandVersion($$)
my @ret = ("# $cvsid");
push @ret, cfgDB_svnId if(configDBUsed());
foreach my $m (sort keys %modules) {
next if(!$modules{$m}{LOADED} || $modules{$m}{ORDER} < 0);
my $max = 7 ; # length("fhem.pl") = 7
foreach my $m (sort {uc($a) cmp uc($b)} keys %modules) {
next if(!$modules{$m}{LOADED} ||
$modules{$m}{ORDER} < 0 ||
($param && $m !~ /$param/));
Log 4, "Looking for SVN Id in module $m";
my $fn = "$attr{global}{modpath}/FHEM/".$modules{$m}{ORDER}."_$m.pm";
if($max < length($modules{$m}{ORDER}."_$m.pm"))
{ $max = length($modules{$m}{ORDER}."_$m.pm") }
if(!open(FH, $fn)) {
my $ret = "$fn: $!";
if(configDBUsed()){
@ -2644,14 +2650,14 @@ CommandVersion($$)
}
push @ret, $ret;
} else {
push @ret, map { chomp; $_ } grep(/# \$Id:/, <FH>);
push @ret, grep(/\$Id. [^\$\n\r].+\$/, <FH>);
}
}
if($param) {
return join("\n", grep /$param/, @ret);
} else {
return join("\n", @ret);
}
@ret = map {/\$Id. (\S+) (.+?)\$/ ? sprintf("%-".$max."s %s",$1,$2) : $_}
@ret;
return sprintf("%-".$max."s %s","File","Rev Last Change\n\n").
join("\n", grep((defined($param) ? ($_ =~ /$param/) : 1), @ret));
}
#####################################