}
print_test_row('Opening connection to database [' . config_get_global('database_name') . '] on host [' . config_get_global('hostname') . '] with username [' . config_get_global('db_username') . ']', @db_connect(config_get_global('dsn', false), config_get_global('hostname'), config_get_global('db_username'), config_get_global('db_password'), config_get_global('database_name')) != false);
if (!db_is_connected()) {
    print_info_row('Database is not connected - Can not continue checks');
}
require_once 'obsolete.php';
if (isset($ADODB_vers)) {
    # ADOConnection::Version() is broken as it treats v5.1 the same as v5.10
    # Therefore we must extract the correct version ourselves
    # Upstream bug report: http://phplens.com/lens/lensforum/msgs.php?id=18320
    if (preg_match('/^[Vv]([0-9\\.]+)/', $ADODB_vers, $t_matches) == 1) {
        $t_adodb_version_check_ok = version_compare($t_matches[1], '5.10', '>=');
    }
}
print_test_warn_row('Checking adodb version...', $t_adodb_version_check_ok, $ADODB_vers);
print_test_row('Checking using bundled adodb with some drivers...', !(db_is_pgsql() || db_is_mssql() || db_is_db2()) || strstr($ADODB_vers, 'MantisBT Version') !== false);
$t_serverinfo = $g_db->ServerInfo();
print_info_row('Database Type (adodb)', $g_db->databaseType);
print_info_row('Database Provider (adodb)', $g_db->dataProvider);
print_info_row('Database Server Description (adodb)', $t_serverinfo['description']);
print_info_row('Database Server Description (version)', $t_serverinfo['version']);
print_test_row('Checking to see if your absolute_path config option has a trailing slash: "' . config_get_global('absolute_path') . '"', "\\" == substr(config_get_global('absolute_path'), -1, 1) || "/" == substr(config_get_global('absolute_path'), -1, 1));
// Windows-only checks
if (is_windows_server()) {
    print_test_row('validate_email (if ON) requires php 5.3 on windows...', OFF == config_get_global('validate_email') || ON == config_get_global('validate_email') && version_compare(phpversion(), '5.3.0', '>='));
    print_test_row('check_mx_record (if ON) requires php 5.3 on windows...', OFF == config_get_global('check_mx_record') || ON == config_get_global('check_mx_record') && version_compare(phpversion(), '5.3.0', '>='));
}
$t_vars = array('magic_quotes_gpc', 'include_path');
while (list($t_foo, $t_var) = each($t_vars)) {
    print_info_row($t_var, ini_get($t_var));
}
/**
 * Check if the specified table exists.
 * @param string $p_table_name a valid database table name
 * @return bool indicating whether the table exists
 */
function db_table_exists($p_table_name)
{
    global $g_db, $g_db_schema;
    if (is_blank($p_table_name)) {
        return false;
    }
    if (db_is_db2()) {
        // must pass schema
        $t_tables = $g_db->MetaTables('TABLE', false, '', $g_db_schema);
    } else {
        $t_tables = $g_db->MetaTables('TABLE');
    }
    # Can't use in_array() since it is case sensitive
    $t_table_name = utf8_strtolower($p_table_name);
    foreach ($t_tables as $t_current_table) {
        if (utf8_strtolower($t_current_table) == $t_table_name) {
            return true;
        }
    }
    return false;
}
Exemple #3
0
/**
 * get list database tables
 * @return array containing table names
 */
function db_get_table_list()
{
    global $g_db, $g_db_schema;
    if (db_is_db2()) {
        // must pass schema
        $t_tables = $g_db->MetaTables('TABLE', false, '', $g_db_schema);
    } else {
        $t_tables = $g_db->MetaTables('TABLE');
    }
    return $t_tables;
}