From 3891b63a1eb52076337885487f251a10580a4a85 Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Wed, 27 Apr 2016 18:50:13 +0200 Subject: Bug 218917 - Allow the login name to be different from the email address Original patch by Gervase Markham r=gerv a=dkl --- Bugzilla/Config.pm | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) (limited to 'Bugzilla/Config.pm') 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 + +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 Description: Writes the parameters to disk. -- cgit v1.2.3-24-g4f1b