Skip to content

Commit

Permalink
Item1829: Configure shouldn't crash if there is no LocalSite.cfg
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk@4571 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
OlivierRaginel authored and OlivierRaginel committed Jul 28, 2009
1 parent 9615ea8 commit 1f90591
Showing 1 changed file with 22 additions and 15 deletions.
37 changes: 22 additions & 15 deletions core/lib/Foswiki/Configure/Load.pm
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,33 @@ provide defaults, and it would be silly to have them in two places anyway.
sub readConfig {
return if $Foswiki::cfg{ConfigurationFinished};

# Read LocalSite.cfg
unless ( do 'Foswiki.spec' ) {
die <<GOLLYGOSH;
Content-type: text/plain
Perl error when reading Foswiki.spec: $@
Please inform the site admin.
GOLLYGOSH
exit 1;
}
# Read Foswiki.spec and LocalSite.cfg
for my $file (qw( Foswiki.spec LocalSite.cfg)) {
unless ( my $return = do $file ) {
my $errorMessage;
if ($@) {
$errorMessage = "Could not parse $file: $@";
}
elsif ( not defined $return ) {
unless ( $! == 2 && $file eq 'LocalSite.cfg' ) {

# Read LocalSite.cfg
unless ( do 'LocalSite.cfg' ) {
die <<GOLLYGOSH;
# LocalSite.cfg doesn't exist, which is OK
$errorMessage = "Could not do $file: $!";
}
}
elsif ( not $return ) {
$errorMessage = "Could not run $file" unless $return;
}
if ($errorMessage) {
die <<GOLLYGOSH;
Content-type: text/plain
Perl error when reading LocalSite.cfg: $@
$errorMessage
Please inform the site admin.
GOLLYGOSH
exit 1;
exit 1;
}
}
}

# If we got this far without definitions for key variables, then
Expand Down

0 comments on commit 1f90591

Please sign in to comment.