Skip to content

Commit

Permalink
Item13062: fix extender.pl and make it call the save wizard to update…
Browse files Browse the repository at this point in the history
… LSC
  • Loading branch information
Comment committed Dec 3, 2014
1 parent 9f81bf9 commit 8474592
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 19 deletions.
11 changes: 6 additions & 5 deletions core/lib/Foswiki/Configure/Package.pm
Expand Up @@ -279,9 +279,10 @@ sub option {
}

sub CHANGED {
my $this = shift;
$this->{_reporter}->CHANGED(@_);
$this->_log( "> _Changed:_ $_[0] = " . eval("\$Foswiki::cfg$_[0]") );
my ( $this, $keys ) = @_;
$this->{_reporter}->CHANGED($keys);
my $val = $this->{_reporter}->{changes}->{$keys};
$this->_log("> _Changed:_ $keys = $val");
}

sub WIZARD {
Expand Down Expand Up @@ -414,7 +415,7 @@ sub install {
* Dependencies noted as 'Optional' will not be automatically resolved, and
* CPAN dependencies are not resolved by the web installer.
> After you save your configuration: (opens in new window)
> After your configuration has been saved:
* Visit <a href="$extUrl" target="_blank">$this->{_pkgname} extension page</a>
* Check <a href="$instUrl" target="_blank">InstalledPlugins</a> to check for errors.
WRAPUP
Expand Down Expand Up @@ -485,7 +486,7 @@ HERE
return 1
unless $node->{keys}
&& exists $node->{default};
my $val = $node->decodeValue( $node->{default} );
my $val = $node->decodeValue( eval $node->{default} );
if ( $this->{simulated} ) {
$this->{reporter}->NOTE( "\t* $node->{keys} = "
. Foswiki::Configure::Reporter::uneval($val) );
Expand Down
7 changes: 2 additions & 5 deletions core/lib/Foswiki/Configure/Value.pm
Expand Up @@ -348,13 +348,10 @@ sub decodeValue {
return $value;
}
elsif ( $this->{typename} eq 'BOOLEAN' ) {
my $def = ( defined $this->{default} && $this->{default} ) ? 1 : 0;
my $val = ( defined $value && $value ) ? 1 : 0;
return undef if ( $val == $def );
return $val;
return $value ? 1 : 0;
}

# String or number or boolean, just sling it back
# String or number, just sling it back
return $value;
}

Expand Down
2 changes: 1 addition & 1 deletion core/lib/Foswiki/Configure/Wizards/Save.pm
Expand Up @@ -268,7 +268,7 @@ sub save {
}
else {
unlink $backup if ($backup);
$reporter->NOTE("No change made to $lsc");
$reporter->NOTE("No changes needed to be made to $lsc");
}
return undef; # return the report
}
Expand Down
25 changes: 17 additions & 8 deletions core/tools/extender.pl
Expand Up @@ -71,8 +71,10 @@ package Foswiki::Extender;
}

sub CHANGED {
my $this = shift;
print "CHANGED: $_[0] = $_[1]";
my ( $this, $k ) = @_;
$this->SUPER::CHANGED($k);

#print "\$Foswiki::cfg$k = $this->{changes}->{$k};\n";
}

sub WIZARD {
Expand Down Expand Up @@ -176,6 +178,7 @@ sub _stop {
require Foswiki::Configure::Dependency;
require Foswiki::Configure::Package;
require Foswiki::Configure::Reporter;
require Foswiki::Configure::Query;

=pod
Expand Down Expand Up @@ -407,12 +410,18 @@ sub _install {
my ( $ok, $plugins, $depCPAN ) = $thispkg->install($reporter);

if ( $ok && !$simulate ) {
$reporter->NOTE(
"> Before you can use newly installed plugins, you must enable them in the Enabled Plugins section in configure."
);
foreach my $plu ( sort { lc($a) cmp lc($b) } keys %$plugins ) {
$reporter->NOTE(" * $plu");
}

# Save default values set by the package installer to LocalSite.cfg
my $params = {
wizard => 'Save',
method => 'save',
set => {
map { $_ => eval( $reporter->{changes}->{$_} ) }
keys %{ $reporter->{changes} }
}
};
$reporter->{changes} = {};
my $response = Foswiki::Configure::Query::wizard( $params, $reporter );
}

$reporter->WARN(
Expand Down

0 comments on commit 8474592

Please sign in to comment.