Skip to content

Commit

Permalink
Item12952: Don't NOT_SET keys that are UNDEFINEDOK
Browse files Browse the repository at this point in the history
Older configurations that don't use short URLs probably won't have
{ScriptUrlPaths}{view} defined.  Since that key is UNDEFINEDOK, don't
initialize it to "NOT SET" and invalidate the configuration.

The Save Wizard however uses this same list and the variables to
preserve from bootstrap, so we can't just remove it from the list.
  • Loading branch information
gac410 committed Sep 4, 2014
1 parent 3d009b4 commit 1edb29f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion core/lib/Foswiki/Configure/Load.pm
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ our $ITEMREGEX = qr/(?:\{(?:'(?:\\.|[^'])+'|"(?:\\.|[^"])+"|[A-Za-z0-9_]+)\})+/;
our $TRUE = 1;
our $FALSE = 0;

# Keys in this list are initialized with "NOT SET" if missing from the configuration.
# Bootstrap works out the correct values, and then Foswiki::Configure::Wizards::Save uses
# this list to preserve the Bootstrap settings when loading the Spec files.

our @NOT_SET =
qw( {DataDir} {DefaultUrlHost} {PubUrlPath} {ToolsDir} {WorkingDir}
{PubDir} {TemplateDir} {ScriptDir} {ScriptUrlPath} {ScriptUrlPaths}{view} {ScriptSuffix} {LocalesDir} );
Expand Down Expand Up @@ -147,7 +151,9 @@ GOLLYGOSH

# If we got this far without definitions for key variables, then
# we need to default them. Otherwise we get peppered with
# 'uninitialised variable' alerts later.
# 'uninitialised variable' alerts later. Make an exception for
# keys that are UNDEFINEDOK. (But keep those keys in this list because
# it's also used to preserve bootstrapped values.)

foreach my $var (@NOT_SET) {

Expand All @@ -156,6 +162,7 @@ GOLLYGOSH
# die "$var must be defined in LocalSite.cfg"
# unless( defined $Foswiki::cfg{$var} );
unless ( eval("defined \$Foswiki::cfg$var") ) {
next if ( $var eq '{ScriptUrlPaths}{view}' ); #UNDEFINEDOK
eval("\$Foswiki::cfg$var = 'NOT SET'");
$validLSC = 0;
}
Expand Down

0 comments on commit 1edb29f

Please sign in to comment.