Skip to content

Commit

Permalink
Item13335: apply .spec files when saving configuration
Browse files Browse the repository at this point in the history
Previously, .spec files would only be applied during bootstrapping. This means
that when users install extensions after bootstrapping, it is difficult to
apply the extension's Config.spec file.

In order to make this work, the order in which Foswiki::Configure::Load reads
the files needed to change: previously, Config.spec files were applied after
applying LocalSite.cfg, thus overriding the values stored there. The new code
loads the files in the following order: Foswiki.spec, Config.spec files,
LocalSite.cfg.
  • Loading branch information
jast committed Mar 27, 2015
1 parent 3b2b66d commit fe67109
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions core/lib/Foswiki/Configure/Load.pm
Expand Up @@ -143,14 +143,11 @@ sub readConfig {
# Old configs might not bootstrap the OS settings, so set if needed.
_workOutOS() unless ( $Foswiki::cfg{OS} && $Foswiki::cfg{DetailedOS} );

my @files = qw( Foswiki.spec LocalSite.cfg );
if ($noLocal) {
pop @files;
my @files;
unless ($nospec) {
push @files, 'Foswiki.spec';
}
if ($nospec) {
shift @files;
}
elsif ($config_spec) {
if (!$nospec && $config_spec) {
foreach my $dir (@INC) {
foreach my $subdir ( 'Foswiki/Plugins', 'Foswiki/Contrib' ) {
my $d;
Expand All @@ -170,6 +167,9 @@ sub readConfig {
}
}
}
unless ($noLocal) {
push @files, 'LocalSite.cfg';
}

for my $file (@files) {
my $return = do $file;
Expand Down
4 changes: 2 additions & 2 deletions core/lib/Foswiki/Configure/Wizards/Save.pm
Expand Up @@ -223,8 +223,8 @@ sub save {
else {
%Foswiki::cfg = ();

# Read without expansions and without the .spec
Foswiki::Configure::Load::readConfig( 1, 1 );
# Read without expansions but with the .spec
Foswiki::Configure::Load::readConfig( 1, 0, 1 );
}

# Get changes from 'set' *without* expanding values.
Expand Down

0 comments on commit fe67109

Please sign in to comment.