Skip to content

Commit

Permalink
Show "GOOD" status for installer DB connect checks
Browse files Browse the repository at this point in the history
Since removal of DB2 support (see issue #0021140), the installer does
not display "GOOD" status anymore for Admin and User DB connection
checks.

This also improves the logic for the Admin account connection check, we
now capture a "BAD" status if the Admin can connect to the DB, but does
not have access to the database.

Fixes #22400
  • Loading branch information
dregad committed Feb 17, 2017
1 parent 0802b59 commit 4271855
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions admin/install.php
Expand Up @@ -421,16 +421,18 @@ function print_test( $p_test_description, $p_result, $p_hard_fail = true, $p_mes
$t_result = @$g_db->Connect( $f_hostname, $f_admin_username, $f_admin_password );

if( $t_result ) {

# check if db exists for the admin
$t_result = @$g_db->Connect( $f_hostname, $f_admin_username, $f_admin_password, $f_database_name );
if( $t_result ) {
$t_db_open = true;
$f_db_exists = true;
}
$t_result = @$g_db->Connect( $f_hostname, $f_admin_username, $f_admin_password, $f_database_name.'x' );
}
if( $t_result ) {
$t_db_open = true;
$f_db_exists = true;

# due to a bug in ADODB, this call prompts warnings, hence the @
# the check only works on mysql if the database is open
$t_version_info = @$g_db->ServerInfo();

print_test_result( GOOD );
} else {
print_test_result( BAD, true, 'Does administrative user have access to the database? ( ' . db_error_msg() . ' )' );
$t_version_info = null;
Expand All @@ -450,6 +452,7 @@ function print_test( $p_test_description, $p_result, $p_hard_fail = true, $p_mes

if( $t_result == true ) {
$t_db_open = true;
print_test_result( GOOD );
} else {
print_test_result( BAD, false, 'Database user doesn\'t have access to the database ( ' . db_error_msg() . ' )' );
}
Expand Down

0 comments on commit 4271855

Please sign in to comment.