diff --git a/status/query-monitor.pl b/status/query-monitor.pl index 0bbc9e10d..994977f30 100755 --- a/status/query-monitor.pl +++ b/status/query-monitor.pl @@ -1,8 +1,16 @@ # query-monitor.pl # Try an SQL query on a MySQL or PostgreSQL server +my %allowed_query_drivers = map { $_, 1 } ("mysql", "Pg", "Oracle"); + sub get_query_status { +if (!$allowed_query_drivers{$_[0]->{'driver'}}) { + return { 'up' => -1, + 'desc' => &text('query_edriver', + "DBD::$_[0]->{'driver'}") }; + } + # Load the driver local $drh; eval <DBD::$in{'driver'}")); +eval { + require DBI; + DBI->install_driver($in{'driver'}); + }; &error(&text('query_edriver', "DBD::$in{'driver'}")) if ($@); $_[0]->{'driver'} = $in{'driver'};