lemonldap-ng/scripts/findAttr.pl

106 lines
3.1 KiB
Perl
Raw Permalink Normal View History

2010-10-06 21:58:31 +02:00
#!/usr/bin/perl
use strict;
2010-10-06 21:58:31 +02:00
my $IGNORE = join(
'|', qw(
csr urldc cfgNum p (?:s|rS)essionInfo dn user mustRedirect password dbi\w+
2010-10-07 13:05:36 +02:00
reVHosts stack timezone vident _\w+ lmConf table (?:st|db)h res id
refLocalStorage User Password args conf generate mdone obj error
authChoiceModules deleted entry macros modules notifObject menuModules
mailSessionKey mail logoutServices ns service modified force menuError
2010-12-05 16:54:00 +01:00
cookie SOAPMessage clean func local noQuotes categories noCache
2010-10-06 21:58:31 +02:00
)
);
my ( $attr, $attrFile );
foreach my $module (qw(common handler manager portal)) {
open CMD,
"find lemonldap-ng-$module/lib/Lemonldap/NG -type f -name '*.pm'|";
my @files;
while (<CMD>) {
chomp;
push @files, $_;
}
close CMD;
# my @files = qw(lemonldap-ng-portal/lib/Lemonldap/NG/Portal/AuthChoice.pm);
foreach my $file (@files) {
# Ignode old liberty-Alliance
next if ( $file =~ m#Portal/AuthLA.pm$# );
next if ( $file =~ /_Struct/ );
open F, $file;
$file =~ s#.*/NG/##;
my $autoload = 0;
2010-12-05 16:54:00 +01:00
my $pod = 0;
2010-10-06 21:58:31 +02:00
while (<F>) {
$autoload = 1 if (/use\s+AutoLoader/);
2010-12-05 16:54:00 +01:00
if(/^=/) {
if(/^=cut/){$pod=0;}else{$pod=1};
}
next if($pod);
2010-10-06 21:58:31 +02:00
last if ( /^__END__$/ and not $autoload );
if (/\$(?:self|args)->\{\s*(\w+)\s*\}/) {
2010-10-06 21:58:31 +02:00
my $k = $1;
unless ( $k =~ /^$IGNORE$/o ) {
2010-10-06 21:58:31 +02:00
$attr->{$module}->{$1}++;
$attrFile->{$module}->{$1}->{$file}++;
}
}
}
close F;
}
#use Data::Dumper;
#print Dumper($attr);
}
open F, 'doc/pages/documentation/latest/parameterlist.html';
my $documentedAttr;
while (<F>) {
next unless (/<td class="col1.*?">\s*(\w+)\s*<\/td>/);
$documentedAttr->{$1}++;
}
close F;
2010-10-06 21:58:31 +02:00
open F, 'lemonldap-ng-manager/lib/Lemonldap/NG/Manager/_Struct.pm';
my $managedAttr;
2010-10-07 13:05:36 +02:00
my $buf;
2010-10-06 21:58:31 +02:00
while (<F>) {
$buf = '' if ( $buf =~ /,$/ );
$buf .= $_;
$managedAttr->{$1}++ if ( $buf =~ /=>\s*'\w+:\/(\w+)/s );
2010-10-06 21:58:31 +02:00
}
close F;
my ( $unmanagedAttr, $undocumentedAttr );
2010-10-06 21:58:31 +02:00
foreach my $module (qw(common handler manager portal)) {
foreach my $k ( keys %{ $attr->{$module} } ) {
# Parameter that must not be documented
#next if ( $k =~ /^$IGNORE$/ );
unless ( defined( $managedAttr->{$k} ) ) {
$unmanagedAttr->{$module}->{$k}++;
}
unless ( defined( $documentedAttr->{$k} ) ) {
$undocumentedAttr->{$module}->{$k}++;
}
2010-10-06 21:58:31 +02:00
# TODO: scan doc/4.1-Configuration-parameter-list.html
}
print "\n##### ".uc($module)." #####\n\n### Unmanaged ###\n";
2010-10-06 21:58:31 +02:00
foreach my $k ( sort keys %{ $unmanagedAttr->{$module} } ) {
print "$k => "
. join( ', ', keys( %{ $attrFile->{$module}->{$k} } ) ) . "\n";
}
print "\n### Undocumented ###\n";
foreach my $k ( sort keys %{ $undocumentedAttr->{$module} } ) {
print "$k => "
. join( ', ', keys( %{ $attrFile->{$module}->{$k} } ) ) . "\n";
}
2010-10-06 21:58:31 +02:00
}