From 2545c0950c4f0fde8f78b265217fa9f523eff7bf Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Tue, 20 Jun 2006 03:15:17 +0000 Subject: Bug 304601: Bugzilla::Config's :locations exports need to be in their own module - Patch by Frédéric Buclin r=mkanat for the main patch, r=myk for the patch about CGI.pm a=justdave MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug 328637: Remove all legal_* versioncache arrays - Patch by Frédéric Buclin r=mkanat a=justdave Bug 110503 - Eliminate versioncache --- Bugzilla/Config.pm | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'Bugzilla/Config.pm') diff --git a/Bugzilla/Config.pm b/Bugzilla/Config.pm index a04bbfe8c..3f5b788c2 100644 --- a/Bugzilla/Config.pm +++ b/Bugzilla/Config.pm @@ -112,19 +112,20 @@ use vars qw(@param_list); do $localconfig; my %params; # Load in the param definitions -foreach my $item ((glob "$libpath/Bugzilla/Config/*.pm")) { - $item =~ m#/([^/]+)\.pm$#; - my $module = $1; - next if ($module eq 'Common'); - require "Bugzilla/Config/$module.pm"; - my @new_param_list = "Bugzilla::Config::$module"->get_param_list(); - foreach my $item (@new_param_list) { - $params{$item->{'name'}} = $item; +sub _load_params { + foreach my $item ((glob "$libpath/Bugzilla/Config/*.pm")) { + $item =~ m#/([^/]+)\.pm$#; + my $module = $1; + next if ($module eq 'Common'); + require "Bugzilla/Config/$module.pm"; + my @new_param_list = "Bugzilla::Config::$module"->get_param_list(); + foreach my $item (@new_param_list) { + $params{$item->{'name'}} = $item; + } + push(@parampanels, $module); + push(@param_list, @new_param_list); } - push(@parampanels, $module); - push(@param_list, @new_param_list); } - # END INIT CODE # Subroutines go here @@ -132,6 +133,7 @@ foreach my $item ((glob "$libpath/Bugzilla/Config/*.pm")) { sub Param { my ($param) = @_; + _load_params unless %params; my %param_values = %{Bugzilla->params}; # By this stage, the param must be in the hash @@ -153,6 +155,7 @@ sub Param { sub SetParam { my ($name, $value) = @_; + _load_params unless %params; die "Unknown param $name" unless (exists $params{$name}); my $entry = $params{$name}; @@ -176,7 +179,6 @@ sub UpdateParams { # Note that this isn't particularly 'clean' in terms of separating # the backend code (ie this) from the actual params. # We don't care about that, though - my $param = Bugzilla->params; # Old Bugzilla versions stored the version number in the params file @@ -239,6 +241,7 @@ sub UpdateParams { # --- DEFAULTS FOR NEW PARAMS --- + _load_params unless %params; foreach my $item (@param_list) { my $name = $item->{'name'}; $param->{$name} = $item->{'default'} unless exists $param->{$name}; -- cgit v1.2.3-24-g4f1b