From ab9642fffb11fae3a66e816dde8d5212c63d2702 Mon Sep 17 00:00:00 2001 From: till Date: Fri, 15 Feb 2008 13:21:01 +0000 Subject: * extended db checks (also for optional read-only dsn) --- check.php-dist | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) (limited to 'check.php-dist') diff --git a/check.php-dist b/check.php-dist index 842dc2372..26b9b01cb 100644 --- a/check.php-dist +++ b/check.php-dist @@ -58,6 +58,7 @@ $rctest_config['from'] = '_yourfrom_'; define('CHECK_OK', 'OK'); define('CHECK_NOK', 'NOT OK'); +define('CHECK_NA', 'NOT AVAILABLE'); error_reporting(E_ALL ^E_NOTICE); @@ -84,6 +85,8 @@ $supported_dbs = array('MySQL' => 'mysql', 'MySQLi' => 'mysqli', $path = dirname(__FILE__) . '/'; $check = basename(__FILE__); + +include_once 'include/bugs.inc'; ?> @@ -97,6 +100,7 @@ $check = basename(__FILE__); h4 { margin-bottom: 0.2em; } .success { color:#006400;font-weight:bold !important; } .fail { color:#ff0000 !important;font-weight:bold !important; } + .na { color:#f60; font-weight:bold; } /* ]]> */ RoundCube :: check @@ -111,7 +115,8 @@ if ($rctest_config['from'] == '_yourfrom_') { echo CHECK_NOK; } else { echo $rctest_config['from'] . '

'; - echo 'We do not check if this is a valid email address. Since this serves as from & to, make sure it is correct!'; + echo 'Note: We do not check if this is a valid email address.'; + echo ' Because this settings serves as from & to, make sure it is correctly set!'; } echo '

Checking available databases

'; @@ -124,7 +129,7 @@ foreach ($supported_dbs AS $database => $ext) { echo CHECK_OK; } else { $_ext = $prefix . $ext . '.' . PHP_SHLIB_SUFFIX; - echo CHECK_NOK; + echo CHECK_NA; if (@dl($_ext)) { echo ' (Could be loaded. Please add in php.ini, if you plan on using it.)'; } else { @@ -185,17 +190,30 @@ echo '

Check supplied DB settings

'; $db_working = false; if (isset($rcmail_config)) { - echo 'DB settings: '; - include_once 'MDB2.php'; - $db = MDB2::connect($rcmail_config['db_dsnw']); - if (!MDB2::IsError($db)) { + require_once 'include/rcube_mdb2.inc'; + echo 'DB (standard): '; + $DB = new rcube_mdb2($rcmail_config['db_dsnw'], '', false); + $DB->db_connect('w'); + if (!$DB->is_error()) { echo CHECK_OK; - $db->disconnect(); $db_working = true; } else { echo CHECK_NOK; } echo '
'; + echo 'DB (read-only, optional): '; + if ($rcmail_config['db_dsnr'] != '') { + $DB_READ = new rcube_mdb2($rcmail_config['db_dsnr'], '', false); + $DB_READ->db_connect('w'); + if (!$DB_READ->is_error()) { + echo CHECK_OK; + } else { + echo CHECK_NOK . ' (It\'s configured, but not working!)'; + } + } else { + echo CHECK_NA; + } + echo '
'; } else { echo 'Could not open db.inc.php config file, or file is empty.
'; } @@ -204,9 +222,8 @@ echo '

TimeZone

'; echo 'Checks if web- and databaseserver are in the same timezone.

'; echo 'Status: '; if ($db_working === true) { - require_once 'include/rcube_mdb2.inc'; - $DB = new rcube_mdb2($rcmail_config['db_dsnw'], '', false); - $DB->db_connect('w'); + //$DB = new rcube_mdb2($rcmail_config['db_dsnw'], '', false); + //$DB->db_connect('w'); $tz_db = "SELECT " . $DB->unixtimestamp($DB->now()) . " AS tz_db"; $tz_db = $DB->query($tz_db); -- cgit v1.2.3