*** /e/www/twiki-dakar-4.0.2/bin/configure~ Fri Mar 31 23:44:21 2006 --- /e/www/twiki-dakar-4.0.2/bin/configure Tue Aug 22 22:29:27 2006 *************** *** 1045,1069 **** } sub _showPlugins { ! my %modules; ! foreach my $libDir ( @INC ) { ! if( opendir( DIR, "$libDir/TWiki/Plugins" ) ) { ! foreach my $file ( grep { /^[A-Za-z0-9_]+Plugin\.pm$/ } ! readdir DIR ) { ! my $module = $file; ! $module =~ s/\.pm$//; ! $TWiki::cfg{Plugins}{$module}{Enabled} ||= 0; ! $module =~ /^(.*)$/; # untaint ! $module = $1; ! # only add the first instance of any plugin, as only ! # the first can get loaded from @INC. ! unless( $modules{$module} ) { ! $modules{$module} = $libDir; ! } ! closedir( DIR ); ! } ! } ! } my $block = ''; foreach my $m ( sort keys %modules ) { $block .= _checkAndBuildValueGrabber --- 1045,1051 ---- } sub _showPlugins { ! my %modules = _discoverPlugins(); my $block = ''; foreach my $m ( sort keys %modules ) { $block .= _checkAndBuildValueGrabber *************** *** 1072,1077 **** --- 1054,1067 ---- "$m", '{Plugins}{'.$m.'}{Enabled}' ); + # Load plugin config file so that appropriate setting is shown + my $cfgfile = _findFileOnPath("TWiki/Plugins/$m/LocalSite.cfg"); + if ( $cfgfile ) { + unless( eval 'do "$cfgfile"' ) { + $block .= + ERROR("lib/TWiki/Plugins/$m/LocalSite.cfg is unreadable or has a configuration problem that is causing a Perl error"); + } + } } return $block; } *************** *** 1772,1784 **** return $output; }; sub presentEditableInfo { ! # "Parse" TWiki.cfg and LocalSite.cfg my $output = ''; my @blocks; my @heads; my $depth = 0; ! for my $file ( 'TWiki.cfg', 'LocalSite.cfg' ) { my $cfgfile = _findFileOnPath($file); next unless $cfgfile; open(F, $cfgfile) || next; --- 1762,1799 ---- return $output; }; + sub _discoverPlugins { + my %modules; + foreach my $libDir ( @INC ) { + if( opendir( DIR, "$libDir/TWiki/Plugins" ) ) { + foreach my $file ( grep { /^[A-Za-z0-9_]+Plugin\.pm$/ } + readdir DIR ) { + my $module = $file; + $module =~ s/\.pm$//; + $TWiki::cfg{Plugins}{$module}{Enabled} ||= 0; + $module =~ /^(.*)$/; # untaint + $module = $1; + # only add the first instance of any plugin, as only + # the first can get loaded from @INC. + unless( $modules{$module} ) { + $modules{$module} = $libDir; + } + closedir( DIR ); + } + } + } + return %modules; + } + sub presentEditableInfo { ! # "Parse" TWiki.cfg and LocalSite.cfg as well as all plugins specific config files my $output = ''; my @blocks; my @heads; my $depth = 0; ! my %modules = _discoverPlugins(); ! ! for my $file ( 'TWiki.cfg', 'LocalSite.cfg', map { "TWiki/Plugins/$_/LocalSite.cfg" } sort keys %modules ) { my $cfgfile = _findFileOnPath($file); next unless $cfgfile; open(F, $cfgfile) || next; *************** *** 1828,1833 **** --- 1843,1854 ---- $descr = ''; } $blocks[$depth] .= _showPlugins(); + # reload + # Reload LocalSite.cfg to override plugin config settings, + # if defined. A small issue: if the plugin config evaluates + # to null, and the setting is not in LocalSite.cfg, it will + # not be saved into LocalSite.cfg. + eval 'do "LocalSite.cfg"'; } elsif ( m/\*LANGUAGES\*/ ) { if ( $type eq '_HELP' ) { $blocks[$depth] .= _docBlock( $descr );