Index: bin/testenv =================================================================== --- bin/testenv (revision 4163) +++ bin/testenv (working copy) @@ -255,15 +255,15 @@ print "

Perl Module(s) missing

\n"; } $modMissing = 1; - print "

Warning: "; - print "Essential module $mod not installed - please check your Perl\n"; - print "installation, including the setting of \@INC, and re-install Perl if necessary.

\n"; + print "

Warning: "; + print "Essential module $mod not installed - please check your Perl\n"; + print "installation, including the setting of \@INC, and re-install Perl if necessary.

\n"; } } # If any critical modules missing, display @INC and give up if ($modMissing) { - print "

\@INC setting:
"; + print "

\@INC setting:
"; print join "
\n", @INC; print "

\n"; print "\n\n"; @@ -277,10 +277,51 @@ my $query = new CGI; -print $query->header(), - $query->start_html("Test TWiki environment"), - $query->h1("Test the environment for TWiki"), - "Please read the TWikiInstallationGuide for more information on TWiki installation. +print $query->header(); +print < + + + TWiki Test Environment + + + +
+EOM +#print $query->start_html("TWiki Diagnostic Environment"), +print "

TWiki Test Environment

\nPlease read the TWikiInstallationGuide for more information on TWiki installation.
If your TWiki site is working, the front page should be right here."; # TWiki.cfg was read earlier, in BEGIN block. @@ -288,7 +329,7 @@ if ($brokenTWikiCfg) { $brokenTWikiCfgError =~ s!\n!
\n!sg; # Format properly print $query->h3("Configuration error"); - print "WARNING: "; + print "WARNING: "; print "TWiki.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 "$brokenTWikiCfgError\n"; @@ -299,7 +340,7 @@ if ($brokenLocalSiteCfg) { $brokenLocalSiteError =~ s!\n!
\n!sg; # Format properly print $query->h3("Configuration error"); - print "WARNING: "; + 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"; @@ -467,7 +508,7 @@ $twikiFound = 1; my $mod_version = eval '$TWiki::wikiversion || $TWiki::VERSION'; $mod_version ||= 'unknown'; - RIGHT("OK, $mod.pm found (Version: $mod_version)"); + RIGHT("OK, $mod.pm found (Version: $mod_version)"); } # Do locale settings if TWiki.pm was found @@ -542,16 +583,16 @@ import CGI::Carp qw( fatalsToBrowser ); # PATH_INFO -LEFT("PATH_INFO"); +LEFT("PATH_INFO"); RIGHT("$thePathInfo", - NOTE("For a URL such as $theUrl/foo/bar,", - "the correct PATH_INFO is /foo/bar, without any prefixed path", + NOTE("For a URL such as $theUrl/foo/bar,", + "the correct PATH_INFO is /foo/bar, without any prefixed path", "components. ", - "Test this now", + "Test this now", "- particularly if you are using mod_perl, Apache or IIS, or are using", "a web hosting provider.", "The page resulting from the test link should have a PATH_INFO of", - "/foo/bar.")); + "/foo/bar.")); # mod_perl my $usingModPerlText = $usingModPerl ? "Used" : "Not used"; @@ -618,7 +659,7 @@ "port number) of the TWiki URL."); my $val = $ENV{"HTTP_HOST"} || ''; if( $cfg{DefaultUrlHost} !~ /$val/ ) { - $n .= WARN("This does not match HTTP_HOST"); + $n .= WARN("This does not match HTTP_HOST"); } RIGHT($n); @@ -629,11 +670,11 @@ "TWiki cgi-bin directory."); $val = $ENV{"REQUEST_URI"} || ''; if( not $val ) { # REQUEST_URI not set by IIS - $n .= WARN("This web server does not set REQUEST_URI,", + $n .= WARN("This web server does not set REQUEST_URI,", "so it's not possible to check the correctness of ", "this setting."); } elsif ( $val !~ /^$cfg{ScriptUrlPath}/ ) { - $n .= WARN("This does not match REQUEST_URI"); + $n .= WARN("This does not match REQUEST_URI"); } RIGHT($n); @@ -642,11 +683,11 @@ NOTE("This must be the URL of the public directory.", "This is not set correctly if the ", "$cfg{PubUrlPath}/wikiHome.gif image below is broken:
", - "")); + "\"TWiki")); checkdir( "PubDir", $cfg{PubDir}, NOTE("This is the public directory, as seen from the file system. ". - "It must correspond to PubUrlPath."), + "It must correspond to PubUrlPath."), "wikiHome.gif", "w" ); checkdir( "TemplateDir", $cfg{TemplateDir}, @@ -727,7 +768,7 @@ $n .= "Bourne shell or 'bash'."; } if( !$cfg{SafeEnvPath} ) { - $n .= WARN("Security issue: SafeEnvPath set to empty string."); + $n .= WARN("Security issue: SafeEnvPath set to empty string."); } RIGHT($cfg{SafeEnvPath}, NOTE($n)); @@ -782,7 +823,7 @@ LEFT("Current PATH"); RIGHT($currentPath, NOTE("This is the actual PATH setting that will be used by Perl to run ", - "programs. It is normally identical to SafeEnvPath, unless", + "programs. It is normally identical to SafeEnvPath, unless", "that variable is empty.")); @@ -819,22 +860,22 @@ "program is used to run commands that use 'pipes'. Examples", "of shell programs are \n", "cmd.exe, command.com (aka 'DOS Prompt'), and Cygwin's 'bash'\n", - "(recommended if Cygwin is installed).\n", + "(recommended if Cygwin is installed).\n", "

\n", "To use 'bash' with ActiveState or other Win32 Perls,", "you should set the \n", "PERL5SHELL environment variable to something like ", - "c:/YOURCYGWINDIR/bin/bash.exe -c.", + "c:/YOURCYGWINDIR/bin/bash.exe -c.", "This should be set in the System Environment, and ideally set \n", "directly in the web server (e.g. using the Apache SetEnv", "command, followed by an Apache restart). Once this is done, you", - "should re-run testenv\n", + "should re-run testenv\n", "to check that PERL5SHELL is set properly.\n"); if ($perltype eq 'ActiveState' and Win32::BuildNumber() < $ActivePerlRecommendedBuild ) { - $n .= WARN("ActiveState Perl must be upgraded to build ", + $n .= WARN("ActiveState Perl must be upgraded to build ", $ActivePerlRecommendedBuild, - " if you are going to use PERL5SHELL, which was broken", + " if you are going to use PERL5SHELL, which was broken", "in earlier builds."); } RIGHT($n); @@ -867,7 +908,7 @@ # Warn re known broken locale setup $n .= WARN("Using Perl on Windows, which may have missing or", "incorrect locales (in Cygwin or ActiveState Perl,", - "respectively) - use of LocaleRegexes = 0", + "respectively) - use of LocaleRegexes = 0", "(see below) is recommended unless you know your", "version of Perl has working locale support."); } @@ -885,7 +926,7 @@ LEFT("SiteLocale"); $n = $cfg{SiteLocale}. NOTE("This sets the site-wide locale - for example,", - "de_AT.ISO-8859-1 where 'de' is the language code,", + "de_AT.ISO-8859-1 where 'de' is the language code,", "'AT' the country code and 'ISO-8859-1' is the character set.", "Use the locale -a command on your system to", "determine available locales."); @@ -898,7 +939,7 @@ "- please test your locale settings. This warning can", "be ignored if you are not planning to use locales (e.g.", "your site uses English only) - or you can set ", - "SiteLocale to C, which should", + "SiteLocale to C, which should", "always work."); } RIGHT($n); @@ -911,7 +952,7 @@ LEFT("SiteCharsetOverride"); $n = $cfg{SiteCharsetOverride}. NOTE("This only needs to be set if the calculated charset", - "$siteCharset, which is derived from the site-wide", + "$siteCharset, which is derived from the site-wide", "locale setting, is wrong. This setting is used in HTML pages", "and HTTP headers, so it must be acceptable to web browsers", "even if it is different to the locale-derived setting", @@ -956,8 +997,8 @@ "locale-dependent regular expressions (e.g. [:upper:]) are\n", "used by Perl and 'grep'. It is used in environments where locales are\n", "broken, to allow use of internationalised WikiWords. You should\n", - "configure UseLocale to 1, and set a reasonable\n", - "SiteLocale, since this enables correct setting of the\n", + "configure UseLocale to 1, and set a reasonable\n", + "SiteLocale, since this enables correct setting of the\n", "site charset for use by web browsers. Don't change this\n", "setting unless your locales are not working for whatever reason\n"); RIGHT($n); @@ -982,8 +1023,8 @@ unless( $cfg{UseLocale} && $cfg{LocaleRegexes} ) { LEFT("UpperNational"); $n = $cfg{UpperNational}. - NOTE("This setting is used when UseLocale is 0 or", - "LocaleRegexes is 0, to work around missing or", + NOTE("This setting is used when UseLocale is 0 or", + "LocaleRegexes is 0, to work around missing or", "non-working locales.\n", "It is also used with Perl 5.005 for efficiency reasons", "- upgrading to Perl 5.6.1 with working locales is", @@ -993,18 +1034,18 @@ if ( $forUpperNat ) { $n .= NOTE("The following upper case accented characters have", "been found in this locale and should be considered", - "for use in this parameter: $forUpperNat"); + "for use in this parameter: $forUpperNat"); } RIGHT($n); LEFT("LowerNational"); $n = $cfg{LowerNational}. - NOTE("This setting is used whenever UpperNational is used.", + NOTE("This setting is used whenever UpperNational is used.", "It should be set to the lower case accented characters you", "require in your locale."); if ( $forLowerNat ) { $n = NOTE("The following lower case accented characters have", "been found in this locale and should be considered", - "for use in this parameter: $forLowerNat"); + "for use in this parameter: $forLowerNat"); } RIGHT($n); } @@ -1012,11 +1053,10 @@ } print $query->end_table(); - -print $query->hr(), - $query->h1("Complete list of configuration parameters"), +print "

\n"; +print $query->h1("Complete list of configuration parameters"), explode(\%cfg); - +print "
\n"; print $query->end_html(); # End of code @@ -1116,9 +1156,9 @@ if( defined $file && !-e "$dir/$file" ) { $n .= ERROR("Directory $dir does not exist or file $file does not exist in this directory."); } elsif( $perms =~ /w/ && ! testFileIsWritable( "$dir/testenv.test" ) ) { - $n .= ERROR("The directory must exist and be writable by the $usr user."); + $n .= ERROR("The directory must exist and be writable by the $usr user."); } elsif( $perms !~ /w/ && testFileIsWritable( "$dir/testenv.test" ) ) { - $n .= WARN("Security issue: The directory should not be writable by the $usr user."); + $n .= WARN("Security issue: The directory should not be writable by the $usr user."); } RIGHT($n); } @@ -1149,27 +1189,27 @@ # one column sub BOTH { my $text = join(" ",@_); - print "$text\n"; + print "$text\n"; } # both columns used to show a heading sub BIGHEAD { - print BOTH("

",join(" ",@_),"

"); + BOTH("

",join(" ",@_),"

"); } # a note sub NOTE { - return "
Note: ".join(" ",@_); + return "
Note: ".join(" ",@_); } # a warning sub WARN { - return "
Warning: ".join(" ",@_); + return "
Warning: ".join(" ",@_); } # an error sub ERROR { - return "
Error: ".join(" ",@_); + return "
Error: ".join(" ",@_); } # expand a hash into a human-readable table. used to show all @@ -1181,9 +1221,10 @@ $tab .= "$n\n"; if( ref($hash->{$n}) =~ /^HASH/) { $tab .= "{".explode($hash->{$n})."}\n"; - } else { - my $val = $hash->{$n} || ""; - $tab .= "$val\n"; + } + else { + my $val = $hash->{$n} || ""; + $tab .= "$val\n"; } $tab .= ""; }