diff --git a/includes/config.php b/includes/config.php index 1d4d07c65..4cc617052 100644 --- a/includes/config.php +++ b/includes/config.php @@ -343,7 +343,7 @@ function do_config($callingFromInstall=false) //echo "
"; print_r($rows); echo ""; exit; if (!$rows || empty($rows) || empty($rows[0])) { - header($locateStr . 'UNKNOWN&reason=missing'); + header($locateStr); exit; } else { $versionInDb = $rows[0][0]; @@ -367,7 +367,7 @@ function do_config($callingFromInstall=false) } else { if (!$callingFromInstall) { // Must mean we don't have a settings.php file or env variables. - header($locateStr . 'UNKNOWN'); + header($locateStr); exit; } } diff --git a/install/index.php b/install/index.php index 5d644dbb8..96d02254e 100644 --- a/install/index.php +++ b/install/index.php @@ -1,4 +1,5 @@ connect_error) { + return false; + } + return true; + } else { + $c = @dbi_connect( + $_SESSION['db_host'], + $_SESSION['db_login'], + $_SESSION['db_password'], + $_SESSION['db_database'], + false + ); + } + } catch (Exception $e) { return false; } - $c = @dbi_connect( - $_SESSION['db_host'], - $_SESSION['db_login'], - $_SESSION['db_password'], - $_SESSION['db_database'], - false - ); return !empty($c); } @@ -210,7 +231,14 @@ function_exists('gd_info'), translate('Safe Mode needs to be disabled to allow setting env variables to specify the timezone') ] ]; -//echo "
"; print_r($php_settings); echo ""; +if ($debugInstaller) { + echo "
"; + print_r($php_settings); + echo ""; + echo "
"; + print_r($settings); + echo ""; +} // Has the user modified the App Settings so they are different than settings.php if (empty($_SESSION['appSettingsModified'])) { $appSettingsModified = false; @@ -221,8 +249,13 @@ function_exists('gd_info'), // Can we connect? $connectError = ''; $canConnectDb = tryDbConnect(); -if (!$canConnectDb) - $connectError = dbi_error (); +if (!$canConnectDb) { + if (empty($settings['db_type'])) { + $connectError = translate('Connection not yet configured'); + } else { + $connectError = dbi_error(); + } +} $emptyDatabase = $canConnectDb ? isEmptyDatabase() : true; $unsavedDbSettings = !empty($_SESSION['unsavedDbSettings']); // Keep track if Db settings were modified by not yet saved $reportedDbVersion = 'Unknown'; @@ -231,7 +264,7 @@ function_exists('gd_info'), $databaseCurrent = false; $settingsSaved = true; // True if a valid settings.php found unless user changes settings $detectedDbVersion = 'Unknown'; -if ($canConnectDb) { +if ($canConnectDb && !empty($db_connection)) { $reportedDbVersion = getDbVersion(); $detectedDbVersion = getDatabaseVersionFromSchema(); if ($debugInstaller) { @@ -283,7 +316,6 @@ function_exists('gd_info'), ["step" => "dbsettings", "name" => "Database Configuration", "complete" => $canConnectDb && !$unsavedDbSettings], ["step" => "createdb", "name" => "Create Database", "complete" => $databaseExists && !$unsavedDbSettings], ["step" => "dbtables", "name" => "Create/Update Tables", "complete" => $databaseCurrent && !$unsavedDbSettings], - ["step" => "dbload", "name" => "Load Defaults", "complete" => !$emptyDatabase], ["step" => "adminuser", "name" => "Create Admin User", "complete" => $adminUserCount > 0 && !$unsavedDbSettings], ["step" => "finish", "name" => "Completion", "complete" => false] ]; @@ -291,8 +323,8 @@ function_exists('gd_info'), $action = $_POST['action'] ?? 'welcome'; // Make sure we received the CSRF token if (empty($_POST['csrf_form_key'])) { - $_SESSION['alert'] = translate('Your form post was either missing a required session token or timed out.'); - redirectToAction($action); + $_SESSION['alert'] = translate('Your form post was either missing a required session token or timed out.'); + redirectToAction($action); } } else { $action = $_GET['action'] ?? 'welcome'; @@ -457,7 +489,7 @@ function_exists('gd_info'),