Skip to content

Commit

Permalink
Item13040: Fixes for configure under FCGI
Browse files Browse the repository at this point in the history
SafeEnvPath has to be manually set under nginx fcgi.  Detect missing PATH
and report an ERROR.

ScriptSuffix checker needs to ignore the .fcgi suffix.
  • Loading branch information
gac410 committed Sep 29, 2014
1 parent a53c13e commit 5a8b8a8
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 16 deletions.
46 changes: 30 additions & 16 deletions core/lib/Foswiki/Configure/Checkers/SafeEnvPath.pm
Expand Up @@ -25,32 +25,46 @@ sub check_current_value {
my ( $this, $reporter ) = @_;

my $pathSep = ( $Foswiki::cfg{DetailedOS} eq 'MSWin32' ) ? ';' : ':';
my $envPath = $ENV{PATH} || "(undefined)";

unless ( defined $ENV{PATH} && $ENV{PATH} ) {
unless ( defined $Foswiki::cfg{SafeEnvPath}
&& $Foswiki::cfg{SafeEnvPath} )
{
$reporter->ERROR(
"The Path is not provided by the ENVironment, and SafeEnvPath has not been set. ={SafeEnvPath}= must be manually set for your system."
);
}
}

unless ( $Foswiki::cfg{SafeEnvPath} ) {
$reporter->NOTE(
"Without a setting of {SafeEnvPath}, the PATH used will be taken from the PATH environment variable: $ENV{PATH}"
"Without a setting of {SafeEnvPath}, the PATH used will be taken from the PATH environment variable: $envPath"
);
return;
}

# First, get the proposed path
my @dirs =
( split( /$pathSep/o, $Foswiki::cfg{SafeEnvPath} || $ENV{PATH} ) );
if ( defined $ENV{PATH} ) {

# Check they exist
my $found = 0;
foreach my $dir (@dirs) {
if ( -d $dir ) {
$found++;
}
else {
$reporter->WARN("$dir could not be found");
# First, get the proposed path
my @dirs =
( split( /$pathSep/o, $Foswiki::cfg{SafeEnvPath} || $ENV{PATH} ) );

# Check they exist
my $found = 0;
foreach my $dir (@dirs) {
if ( -d $dir ) {
$found++;
}
else {
$reporter->WARN("$dir could not be found");
}
}
}
if ( $Foswiki::cfg{DetailedOS} eq 'MSWin32' && !$found ) {
$reporter->ERROR(
if ( $Foswiki::cfg{DetailedOS} eq 'MSWin32' && !$found ) {
$reporter->ERROR(
"None of the directories on the path could be found. This path will almost certainly not work on Windows. Normally the minimum acceptable {SafeEnvPath} is C:\\WINDOWS\\System32 (or the equivalent on your system)."
);
);
}
}
}

Expand Down
1 change: 1 addition & 0 deletions core/lib/Foswiki/Configure/Checkers/ScriptSuffix.pm
Expand Up @@ -12,6 +12,7 @@ sub check_current_value {
my ( $this, $reporter ) = @_;

my $currentSuffix = ( fileparse( $0, qr/\.[^.]*/ ) )[2];
$currentSuffix = '' if ( $currentSuffix eq '.fcgi' );
my $expectedSuffix = $Foswiki::cfg{ScriptSuffix} || '';

if ( $currentSuffix ne $expectedSuffix ) {
Expand Down

0 comments on commit 5a8b8a8

Please sign in to comment.