diff options
Diffstat (limited to 'Bugzilla/Config.pm')
-rw-r--r-- | Bugzilla/Config.pm | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/Bugzilla/Config.pm b/Bugzilla/Config.pm index 7a7ba3a3e..79b468f0c 100644 --- a/Bugzilla/Config.pm +++ b/Bugzilla/Config.pm @@ -29,7 +29,10 @@ use File::Basename; # when it shouldn't %Bugzilla::Config::EXPORT_TAGS = ( - admin => [qw(update_params SetParam write_params)], + admin => [qw(update_params + SetParam + call_param_onchange_handlers + write_params)], ); Exporter::export_ok_tags('admin'); @@ -78,7 +81,7 @@ sub param_panels { sub SetParam { my ($name, $value) = @_; - _load_params unless %params; + _load_params() unless %params; die "Unknown param $name" unless (exists $params{$name}); my $entry = $params{$name}; @@ -96,6 +99,19 @@ sub SetParam { Bugzilla->params->{$name} = $value; } +sub call_param_onchange_handlers { + my ($changes) = @_; + + _load_params() unless %params; + + foreach my $name (@$changes) { + my $param = $params{$name}; + if (exists $param->{'onchange'}) { + $param->{'onchange'}->(Bugzilla->params->{$name}); + } + } +} + sub update_params { my ($params) = @_; my $answer = Bugzilla->installation_answers; @@ -211,7 +227,7 @@ sub update_params { # --- DEFAULTS FOR NEW PARAMS --- - _load_params unless %params; + _load_params() unless %params; foreach my $name (keys %params) { my $item = $params{$name}; unless (exists $param->{$name}) { @@ -228,8 +244,10 @@ sub update_params { } } - # Bug 452525: OR based groups are on by default for new installations - $param->{'or_groups'} = 1 if $new_install; + if ($new_install) { + $param->{'or_groups'} = 1; + $param->{'use_email_as_login'} = 0; + } # --- REMOVE OLD PARAMS --- @@ -341,6 +359,7 @@ Bugzilla::Config - Configuration parameters for Bugzilla update_params(); SetParam($param, $value); + call_param_onchange_handlers(\@changes); write_params(); =head1 DESCRIPTION @@ -371,6 +390,16 @@ Prints out information about what it's doing, if it makes any changes. May prompt the user for input, if certain required parameters are not specified. +=item C<call_param_onchange_handlers(\@changes)> + +Expects a list of parameter names. +For each parameter, checks whether there is a change handler defined, +and if so, calls it. + +Params: C<\@changes> (required) - A list of parameter names. + +Returns: nothing + =item C<write_params($params)> Description: Writes the parameters to disk. |