Index: testenv =================================================================== --- testenv (revision 3880) +++ testenv (working copy) @@ -33,6 +33,7 @@ my $brokenTWikiCfg; +my $brokenLocalSiteCfg; BEGIN { # Set default current working directory @@ -49,7 +50,6 @@ unshift @INC, '../lib'; $setlibAvail = 0; } - if( $OS ) { $cfg{DetailedOS} = $detailedOS; $cfg{OS} = $OS; @@ -80,6 +80,14 @@ # Read the configuration file now in order to set locale; # includes checking for broken syntax etc. Need 'require' # to get the $!/$@ to work. + $brokenLocalSiteCfg = 0; + unless( eval 'require "LocalSite.cfg" ' ){ # Includes OS detection + # Capture the Perl error(s) + $brokenLocalSiteCfg = 1; + $brokenLocalSiteError = + ( $! ? "$!\n" : '') . # $! if not readable, + ( $@ ? "$@\n" : ''); # $@ if not compileable + } $brokenTWikiCfg = 0; unless( eval 'require "TWiki.cfg" ' ){ # Includes OS detection # Capture the Perl error(s) @@ -289,7 +297,18 @@ print $query->end_html(); exit; } +if ($brokenLocalSiteCfg) { + $brokenLocalSiteError =~ s!\n!
\n!sg; # Format properly + print $query->h3("Configuration error"); + print "WARNING: "; + print "LocalSite.cfg is unreadable or has a configuration problem that is causing a Perl error - the following message(s) relate to TWiki.cfg and should help locate the problem.

\n"; + print "$brokenLocalSiteError\n"; + # EARLY EXIT + print $query->end_html(); + exit; +} + print $query->start_table(); BIGHEAD("Environment variables"); my $key; @@ -639,17 +658,21 @@ "This is the data directory where TWiki stores all topics.", undef, "w" ); +my $time = TWiki::Time::formatTime( time(), '$year$mo', "servertime"); my $logFile = $cfg{LogFileName}; +$logFile =~ s/%DATE%/$time/go; checkdir( "LogFileName", - $logFile, undef, undef, "w" ); + undef, undef, $logFile, "w" ); $logFile = $cfg{WarningFileName}; +$logFile =~ s/%DATE%/$time/go; checkdir( "WarningFileName", - $logFile, undef, undef, "w" ); + undef, undef, $logFile, "w" ); $logFile = $cfg{DebugFileName}; +$logFile =~ s/%DATE%/$time/go; checkdir( "DebugFileName", - $logFile, undef, undef, "w" ); + undef, undef, $logFile, "w" ); LEFT("MailProgram"); $n = $cfg{MailProgram}; @@ -1066,6 +1089,13 @@ sub checkdir { my( $id, $dir, $descr, $file, $perms ) = @_; LEFT("$id"); + + if (!$dir) { + $file =~ /(.*)\/(.*?)/; + $dir = $1; + $file = $2; + } + my $n = $dir; if( $descr ) { $n .= NOTE( $descr );