From 685c1248d9e004892035c63fa13b15f75cbd2751 Mon Sep 17 00:00:00 2001 From: Shish Date: Tue, 26 Jun 2012 23:51:05 +0100 Subject: [PATCH] use PDO to check PDO drivers --- install.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/install.php b/install.php index 12e7b263..fdddfa30 100644 --- a/install.php +++ b/install.php @@ -134,20 +134,21 @@ function ask_questions() { // {{{ "; } + $drivers = PDO::getAvailableDrivers(); if( - !function_exists("mysql_connect") && - !function_exists("pg_connect") && - !function_exists("sqlite_open") + !in_array("mysql", $drivers) && + !in_array("pgsql", $drivers) && + !in_array("sqlite", $drivers) ) { $errors[] = " No database connection library could be found; shimmie needs - php-pgsql, php-mysql, or php-sqlite + PDO with either Postgres, MySQL, or SQLite drivers "; } - $db_m = function_exists("mysql_connect") ? '' : ""; - $db_p = function_exists("pg_connect") ? '' : ""; - $db_s = function_exists("sqlite_open") ? '' : ""; + $db_m = in_array("mysql", $drivers) ? '' : ""; + $db_p = in_array("pgsql", $drivers) ? '' : ""; + $db_s = in_array("sqlite", $drivers) ? '' : ""; $warn_msg = $warnings ? "

Warnings

".implode("\n
", $warnings) : ""; $err_msg = $errors ? "

Errors

".implode("\n
", $errors) : "";