From 6b9e4a21aada9ab70b9c6452957810fd1cd1114e Mon Sep 17 00:00:00 2001 From: till Date: Thu, 14 Feb 2008 23:11:43 +0000 Subject: * added check for loaded database modules * added MDB2 to lib check --- check.php-dist | 46 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/check.php-dist b/check.php-dist index 800339063..49004cb03 100644 --- a/check.php-dist +++ b/check.php-dist @@ -61,17 +61,26 @@ define('CHECK_NOK', 'NOT OK'); error_reporting(E_ALL ^E_NOTICE); -$include_path = dirname(__FILE__) . '/program/lib/'; +$include_path = dirname(__FILE__) . '/program/lib'; $include_path .= PATH_SEPARATOR; -$include_path .= dirname(__FILE__) . '/program/'; +$include_path .= dirname(__FILE__) . '/program'; $include_path .= PATH_SEPARATOR; $include_path .= get_include_path(); @ini_set('display_errors', 1); set_include_path($include_path); -$create_files = array('config/db.inc.php', 'config/main.inc.php'); -$required_libs = array('PEAR' => 'PEAR.php', 'DB' => 'DB.php', 'Net_SMTP' => 'Net/SMTP.php', 'Mail_mime' => 'Mail/mime.php', 'iilConnection' => 'lib/imap.inc'); +$create_files = array('config/db.inc.php', 'config/main.inc.php'); + +$required_libs = array('PEAR' => 'PEAR.php', 'DB' => 'DB.php', + 'Net_SMTP' => 'Net/SMTP.php', 'Mail_mime' => 'Mail/mime.php', + 'MDB2' => 'MDB2.php', 'iilConnection' => 'lib/imap.inc'); + +$supported_drivers = array('MDB2#mysql' => 'MDB2/Driver/mysql.php', + 'MDB2#pgsql' => 'MDB2/Driver/pgsql.php', 'MDB2#sqlite' => 'MDB2/Driver/sqlite.php'); + +$supported_dbs = array('MySQL' => 'mysql', 'MySQLi' => 'mysqli', + 'PostgreSQL' => 'pgsql', 'SQLite (v2)' => 'sqlite'); $path = dirname(__FILE__) . '/'; $check = basename(__FILE__); @@ -105,16 +114,37 @@ if ($rctest_config['from'] == '_yourfrom_') { echo 'We do not check if this is a valid email address. Since this serves as from & to, make sure it is correct!'; } +echo '

Checking available databases

'; +echo '

Checks if the extension is loaded.

'; + +$prefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : ''; +foreach ($supported_dbs AS $database => $ext) { + echo "$database: "; + if (extension_loaded($ext)) { + echo CHECK_OK; + } else { + $_ext = $prefix . $ext . '.' . PHP_SHLIB_SUFFIX; + echo CHECK_NOK; + if (@dl($_ext)) { + echo ' (Could be loaded. Please add in php.ini, if you plan on using it.)'; + } else { + echo ' (Not installed.)'; + } + } + echo '
'; +} + echo '

Check for required 3rd party libs

'; echo '

This also checks if the include path is set correctly.

'; foreach ($required_libs as $classname => $file) { - @include_once $file; + require_once $file; echo "$classname: "; - if (class_exists($classname)) + if (class_exists($classname)) { echo CHECK_OK; - else + } else { echo CHECK_NOK . "; Failed to load $file"; + } echo "
"; } @@ -360,4 +390,4 @@ if ($rcmail_config['default_host'] == '') { } ?> - \ No newline at end of file + -- cgit v1.2.3