From d15c41c6916aa127a3099a09f592b05d418189b1 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Tue, 4 Jul 2006 04:42:45 +0000 Subject: Bug 338375: Use Bugzilla->params everywhere instead of Param(). Patch By Max Kanat-Alexander r=LpSolit, a=justdave --- Bugzilla/Attachment.pm | 1 - Bugzilla/Auth.pm | 1 - Bugzilla/Auth/Login/CGI.pm | 1 - Bugzilla/Auth/Login/Env.pm | 1 - Bugzilla/Auth/Persist/Cookie.pm | 1 - Bugzilla/Auth/Verify/LDAP.pm | 1 - Bugzilla/Bug.pm | 1 - Bugzilla/BugMail.pm | 1 - Bugzilla/Config.pm | 35 ----------------------------------- Bugzilla/DB.pm | 2 +- Bugzilla/Flag.pm | 1 - Bugzilla/FlagType.pm | 1 - Bugzilla/Mailer.pm | 1 - Bugzilla/Search.pm | 1 - Bugzilla/Search/Quicksearch.pm | 1 - Bugzilla/Template.pm | 3 +-- Bugzilla/Template/Plugin/Hook.pm | 1 - Bugzilla/Token.pm | 1 - Bugzilla/User.pm | 1 - 19 files changed, 2 insertions(+), 54 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/Attachment.pm b/Bugzilla/Attachment.pm index 0ed77974f..f012c3f2e 100644 --- a/Bugzilla/Attachment.pm +++ b/Bugzilla/Attachment.pm @@ -50,7 +50,6 @@ that users upload to the Bugzilla server. use Bugzilla::Constants; use Bugzilla::Error; use Bugzilla::Flag; -use Bugzilla::Config; use Bugzilla::User; use Bugzilla::Util qw(trick_taint); diff --git a/Bugzilla/Auth.pm b/Bugzilla/Auth.pm index b6d378a43..40a0917ef 100644 --- a/Bugzilla/Auth.pm +++ b/Bugzilla/Auth.pm @@ -32,7 +32,6 @@ use fields qw( use Bugzilla::Constants; use Bugzilla::Error; -use Bugzilla::Config; use Bugzilla::Auth::Login::Stack; use Bugzilla::Auth::Verify::Stack; use Bugzilla::Auth::Persist::Cookie; diff --git a/Bugzilla/Auth/Login/CGI.pm b/Bugzilla/Auth/Login/CGI.pm index d0c29d8aa..033cb992b 100644 --- a/Bugzilla/Auth/Login/CGI.pm +++ b/Bugzilla/Auth/Login/CGI.pm @@ -33,7 +33,6 @@ use strict; use base qw(Bugzilla::Auth::Login); use constant user_can_create_account => 1; -use Bugzilla::Config; use Bugzilla::Constants; use Bugzilla::Util; use Bugzilla::Error; diff --git a/Bugzilla/Auth/Login/Env.pm b/Bugzilla/Auth/Login/Env.pm index f9837b3e6..180e79ba7 100644 --- a/Bugzilla/Auth/Login/Env.pm +++ b/Bugzilla/Auth/Login/Env.pm @@ -24,7 +24,6 @@ package Bugzilla::Auth::Login::Env; use strict; use base qw(Bugzilla::Auth::Login); -use Bugzilla::Config; use Bugzilla::Constants; use Bugzilla::Error; diff --git a/Bugzilla/Auth/Persist/Cookie.pm b/Bugzilla/Auth/Persist/Cookie.pm index 3d8599c18..3faa892ae 100644 --- a/Bugzilla/Auth/Persist/Cookie.pm +++ b/Bugzilla/Auth/Persist/Cookie.pm @@ -32,7 +32,6 @@ package Bugzilla::Auth::Persist::Cookie; use strict; use fields qw(); -use Bugzilla::Config; use Bugzilla::Constants; use Bugzilla::Util; use Bugzilla::Token; diff --git a/Bugzilla/Auth/Verify/LDAP.pm b/Bugzilla/Auth/Verify/LDAP.pm index 713619589..9f050d854 100644 --- a/Bugzilla/Auth/Verify/LDAP.pm +++ b/Bugzilla/Auth/Verify/LDAP.pm @@ -35,7 +35,6 @@ use fields qw( ldap ); -use Bugzilla::Config; use Bugzilla::Constants; use Bugzilla::Error; diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index 72ca27093..64da19af4 100755 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -33,7 +33,6 @@ use strict; use CGI::Carp qw(fatalsToBrowser); use Bugzilla::Attachment; -use Bugzilla::Config; use Bugzilla::Constants; use Bugzilla::Field; use Bugzilla::Flag; diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm index dc6efc735..ddcf4791e 100644 --- a/Bugzilla/BugMail.pm +++ b/Bugzilla/BugMail.pm @@ -35,7 +35,6 @@ package Bugzilla::BugMail; use Bugzilla::Error; use Bugzilla::User; use Bugzilla::Constants; -use Bugzilla::Config; use Bugzilla::Util; use Bugzilla::Bug; use Bugzilla::Product; diff --git a/Bugzilla/Config.pm b/Bugzilla/Config.pm index c4a23f9cb..57c60dbb0 100644 --- a/Bugzilla/Config.pm +++ b/Bugzilla/Config.pm @@ -35,9 +35,6 @@ use strict; use base qw(Exporter); use Bugzilla::Constants; -# Module stuff -@Bugzilla::Config::EXPORT = qw(Param); - # Don't export localvars by default - people should have to explicitly # ask for it, as a (probably futile) attempt to stop code using it # when it shouldn't @@ -92,28 +89,6 @@ sub param_panels { return @param_panels; } -sub Param { - my ($param) = @_; - - _load_params unless %params; - my %param_values = %{Bugzilla->params}; - - # By this stage, the param must be in the hash - die "Can't find param named $param" unless (exists $params{$param}); - - # When module startup code runs (which is does even via -c, when using - # |use|), we may try to grab params which don't exist yet. This affects - # tests, so have this as a fallback for the -c case - return $params{$param}->{default} - if ($^C && not exists $param_values{$param}); - - # If we have a value for the param, return it - return $param_values{$param} if exists $param_values{$param}; - - # Else error out - die "No value for param $param (try running checksetup.pl again)"; -} - sub SetParam { my ($name, $value) = @_; @@ -277,11 +252,6 @@ Bugzilla::Config - Configuration parameters for Bugzilla =head1 SYNOPSIS - # Getting parameters - use Bugzilla::Config; - - my $fooSetting = Bugzilla->params->{'foo'}; - # Administration functions use Bugzilla::Config qw(:admin); @@ -305,11 +275,6 @@ Parameters can be set, retrieved, and updated. =over 4 -=item Cparams->{$name}> - -Returns the Param with the specified name. Either a string, or, in the case -of multiple-choice parameters, an array reference. - =item C Sets the param named $name to $value. Values are checked using the checker diff --git a/Bugzilla/DB.pm b/Bugzilla/DB.pm index 3d30dd778..044aa3dea 100644 --- a/Bugzilla/DB.pm +++ b/Bugzilla/DB.pm @@ -35,7 +35,7 @@ use DBI; # Inherit the DB class from DBI::db. use base qw(DBI::db); -use Bugzilla::Config qw(:DEFAULT :db); +use Bugzilla::Config qw(:db); use Bugzilla::Constants; use Bugzilla::Util; use Bugzilla::Error; diff --git a/Bugzilla/Flag.pm b/Bugzilla/Flag.pm index 8646e72ac..50721f159 100644 --- a/Bugzilla/Flag.pm +++ b/Bugzilla/Flag.pm @@ -61,7 +61,6 @@ package Bugzilla::Flag; use Bugzilla::FlagType; use Bugzilla::User; -use Bugzilla::Config; use Bugzilla::Util; use Bugzilla::Error; use Bugzilla::Mailer; diff --git a/Bugzilla/FlagType.pm b/Bugzilla/FlagType.pm index 078f6de71..ce4f31e68 100644 --- a/Bugzilla/FlagType.pm +++ b/Bugzilla/FlagType.pm @@ -59,7 +59,6 @@ use Bugzilla::User; use Bugzilla::Error; use Bugzilla::Util; -use Bugzilla::Config; ###################################################################### # Global Variables diff --git a/Bugzilla/Mailer.pm b/Bugzilla/Mailer.pm index 9f51c71e0..15df6bddd 100644 --- a/Bugzilla/Mailer.pm +++ b/Bugzilla/Mailer.pm @@ -37,7 +37,6 @@ use base qw(Exporter); @Bugzilla::Mailer::EXPORT = qw(MessageToMTA); use Bugzilla::Constants; -use Bugzilla::Config; use Bugzilla::Util; use Mail::Header; diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index f9bf55388..e8da89204 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -34,7 +34,6 @@ package Bugzilla::Search; use base qw(Exporter); @Bugzilla::Search::EXPORT = qw(IsValidQueryType); -use Bugzilla::Config; use Bugzilla::Error; use Bugzilla::Util; use Bugzilla::Constants; diff --git a/Bugzilla/Search/Quicksearch.pm b/Bugzilla/Search/Quicksearch.pm index 48b825318..eba9bac01 100644 --- a/Bugzilla/Search/Quicksearch.pm +++ b/Bugzilla/Search/Quicksearch.pm @@ -23,7 +23,6 @@ package Bugzilla::Search::Quicksearch; # Make it harder for us to do dangerous things in Perl. use strict; -use Bugzilla::Config; use Bugzilla::Error; use Bugzilla::Constants; use Bugzilla::Keyword; diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index 65d937510..6094d6499 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -35,7 +35,6 @@ package Bugzilla::Template; use strict; use Bugzilla::Constants; -use Bugzilla::Config; use Bugzilla::Util; use Bugzilla::User; use Bugzilla::Error; @@ -771,7 +770,7 @@ sub create { # Default variables for all templates VARIABLES => { # Function for retrieving global parameters. - 'Param' => \&Bugzilla::Config::Param, + 'Param' => sub { return Bugzilla->params->{$_[0]}; }, # Function to create date strings 'time2str' => \&Date::Format::time2str, diff --git a/Bugzilla/Template/Plugin/Hook.pm b/Bugzilla/Template/Plugin/Hook.pm index 6f744a8aa..a5eec820b 100644 --- a/Bugzilla/Template/Plugin/Hook.pm +++ b/Bugzilla/Template/Plugin/Hook.pm @@ -25,7 +25,6 @@ package Bugzilla::Template::Plugin::Hook; use strict; -use Bugzilla::Config; use Bugzilla::Constants; use Bugzilla::Template; use Bugzilla::Util; diff --git a/Bugzilla/Token.pm b/Bugzilla/Token.pm index c2e11f5a3..c570c34b1 100644 --- a/Bugzilla/Token.pm +++ b/Bugzilla/Token.pm @@ -29,7 +29,6 @@ use strict; # Bundle the functions in this file together into the "Bugzilla::Token" package. package Bugzilla::Token; -use Bugzilla::Config; use Bugzilla::Error; use Bugzilla::Mailer; use Bugzilla::Util; diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm index 1c30ce024..9977ca86c 100644 --- a/Bugzilla/User.pm +++ b/Bugzilla/User.pm @@ -40,7 +40,6 @@ use strict; # This module implements utilities for dealing with Bugzilla users. package Bugzilla::User; -use Bugzilla::Config; use Bugzilla::Error; use Bugzilla::Util; use Bugzilla::Constants; -- cgit v1.2.3-24-g4f1b