From a2dd3b00284fd4724d3408274cb1156c7a77d187 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Sat, 24 Oct 2009 05:21:06 +0000 Subject: Bug 520948: Use Bugzilla->feature and feature_enabled everywhere instead of checking if modules are installed Patch by Max Kanat-Alexander r=LpSolit, a=LpSolit --- Bugzilla/Config/Common.pm | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'Bugzilla/Config') diff --git a/Bugzilla/Config/Common.pm b/Bugzilla/Config/Common.pm index b722795d4..95866b032 100644 --- a/Bugzilla/Config/Common.pm +++ b/Bugzilla/Config/Common.pm @@ -257,22 +257,29 @@ sub check_user_verify_class { # the login method as LDAP, we won't notice, but all logins will fail. # So don't do that. + my $params = Bugzilla->params; my ($list, $entry) = @_; $list || return 'You need to specify at least one authentication mechanism'; for my $class (split /,\s*/, $list) { my $res = check_multi($class, $entry); return $res if $res; if ($class eq 'RADIUS') { - eval "require Authen::Radius"; - return "Error requiring Authen::Radius: '$@'" if $@; - return "RADIUS servername (RADIUS_server) is missing" unless Bugzilla->params->{"RADIUS_server"}; - return "RADIUS_secret is empty" unless Bugzilla->params->{"RADIUS_secret"}; + if (!Bugzilla->feature('auth_radius')) { + return "RADIUS support is not available. Run checksetup.pl" + . " for more details"; + } + return "RADIUS servername (RADIUS_server) is missing" + if !$params->{"RADIUS_server"}; + return "RADIUS_secret is empty" if !$params->{"RADIUS_secret"}; } elsif ($class eq 'LDAP') { - eval "require Net::LDAP"; - return "Error requiring Net::LDAP: '$@'" if $@; - return "LDAP servername (LDAPserver) is missing" unless Bugzilla->params->{"LDAPserver"}; - return "LDAPBaseDN is empty" unless Bugzilla->params->{"LDAPBaseDN"}; + if (!Bugzilla->feature('auth_ldap')) { + return "LDAP support is not available. Run checksetup.pl" + . " for more details"; + } + return "LDAP servername (LDAPserver) is missing" + if !$params->{"LDAPserver"}; + return "LDAPBaseDN is empty" if !$params->{"LDAPBaseDN"}; } } return ""; @@ -323,9 +330,9 @@ sub check_notification { sub check_smtp_auth { my $username = shift; - if ($username) { - eval "require Authen::SASL"; - return "Error requiring Authen::SASL: '$@'" if $@; + if ($username and !Bugzilla->feature('smtp_auth')) { + return "SMTP Authentication is not available. Run checksetup.pl for" + . " more details"; } return ""; } -- cgit v1.2.3-24-g4f1b