diff options
author | till <till@php.net> | 2008-02-14 23:11:43 +0000 |
---|---|---|
committer | till <till@php.net> | 2008-02-14 23:11:43 +0000 |
commit | 6b9e4a21aada9ab70b9c6452957810fd1cd1114e (patch) | |
tree | b45bb43969e34918708881aabf6c4f425ed85641 /check.php-dist | |
parent | 60dd08732a7ac53ee77ef250d79a5e6aa5d32d6f (diff) |
* added check for loaded database modules
* added MDB2 to lib check
Diffstat (limited to 'check.php-dist')
-rw-r--r-- | check.php-dist | 46 |
1 files 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', '<span class="fail">NOT OK</span>'); 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 '<i>We do not check if this is a <b>valid</b> email address. Since this serves as from & to, make sure it is correct!</i>'; } +echo '<h3>Checking available databases</h3>'; +echo '<p>Checks if the extension is loaded.</p>'; + +$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 ' (<i>Could</i> be loaded. Please add in php.ini, if you plan on using it.)'; + } else { + echo ' (<b>Not</b> installed.)'; + } + } + echo '<br />'; +} + echo '<h3>Check for required 3rd party libs</h3>'; echo '<p>This also checks if the include path is set correctly.</p>'; 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 "<br />"; } @@ -360,4 +390,4 @@ if ($rcmail_config['default_host'] == '') { } ?> </body> -</html>
\ No newline at end of file +</html> |