diff options
author | mkanat%bugzilla.org <> | 2009-10-24 07:21:06 +0200 |
---|---|---|
committer | mkanat%bugzilla.org <> | 2009-10-24 07:21:06 +0200 |
commit | a2dd3b00284fd4724d3408274cb1156c7a77d187 (patch) | |
tree | 4aa41a1c8cea9d31aaccddc4685f8f1c5991c1b4 /Bugzilla/Config | |
parent | 401fb65f2e6f9031cedf47fb6d951236b5c624d3 (diff) | |
download | bugzilla-a2dd3b00284fd4724d3408274cb1156c7a77d187.tar.gz bugzilla-a2dd3b00284fd4724d3408274cb1156c7a77d187.tar.xz |
Bug 520948: Use Bugzilla->feature and feature_enabled everywhere instead of checking if modules are installed
Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=LpSolit
Diffstat (limited to 'Bugzilla/Config')
-rw-r--r-- | Bugzilla/Config/Common.pm | 29 |
1 files changed, 18 insertions, 11 deletions
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 ""; } |