Commit 04e96eea authored by sympa-authors's avatar sympa-authors
Browse files

Fix: Sympa now check if the DBD is available ; otherwise processes would die


git-svn-id: https://subversion.renater.fr/sympa/trunk@3701 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent 3007876e
......@@ -25,6 +25,15 @@ Content-Transfer-Encoding: [%|loc%]_encoding_[%END%]
[%|loc(db_name)%]Cannot connect to database %1, still trying...[%END%]
[% ELSIF type == 'missing_dbd' -%]
Subject: [% FILTER qencode %][%|loc(db_type)%]No DataBase Driver for %1[%END%][%END%]
MIME-Version: 1.0
Content-Type: text/plain; charset=[%|loc%]_charset_[%END%];
Content-Transfer-Encoding: [%|loc%]_encoding_[%END%]
[%|loc(db_type)%]No Database Driver installed for %1 ; you should download and install DBD::%1 from CPAN.[%END%]
[% ELSIF type == 'db_struct_updated' -%]
Subject: [% FILTER qencode %][%|loc%]Database structure updated[%END%][%END%]
MIME-Version: 1.0
......
......@@ -1286,6 +1286,13 @@ sub db_connect {
}
}
## Check if DBD is installed
unless (eval "require DBD::$Conf{'db_type'}") {
do_log('err',"No Database Driver installed for $Conf{'db_type'} ; you should download and install DBD::$Conf{'db_type'} from CPAN");
&send_notify_to_listmaster('missing_dbd', $Conf{'domain'},{'db_type' => $Conf{'db_type'}});
return undef;
}
## Used by Oracle (ORACLE_HOME)
if ($Conf{'db_env'}) {
foreach my $env (split /;/, $Conf{'db_env'}) {
......@@ -8916,6 +8923,12 @@ sub _include_users_sql {
my ($dbh, $sth);
my $connect_string;
unless (eval "require DBD::$db_type") {
do_log('err',"No Database Driver installed for $db_type ; you should download and install DBD::$db_type from CPAN");
&send_notify_to_listmaster('missing_dbd', $Conf{'domain'},{'db_type' => $db_type});
return undef;
}
if ($f_dir) {
$connect_string = "DBI:CSV:f_dir=$f_dir";
}elsif ($db_type eq 'Oracle') {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment