redirect user in install process if database connection settings are wrong

This commit is contained in:
Manuel Raynaud
2014-03-13 16:39:11 +01:00
parent e4ba7d8d11
commit b0b0eac1cf

View File

@@ -32,8 +32,13 @@ if (isset($_POST['host']) && isset($_POST['username']) && isset($_POST['passwor
$_SESSION['install']['port'] = $_POST['port']; $_SESSION['install']['port'] = $_POST['port'];
$checkConnection = new \Thelia\Install\CheckDatabaseConnection($_POST['host'], $_POST['username'], $_POST['password'], $_POST['port']); $checkConnection = new \Thelia\Install\CheckDatabaseConnection($_POST['host'], $_POST['username'], $_POST['password'], $_POST['port']);
if(!$checkConnection->exec()) {
header('location: connection.php?err=1');
exit;
}
$databases = $checkConnection->getConnection()->query('SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA'); $databases = $checkConnection->getConnection()->query('SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA');
if(! $checkConnection->exec() || $databases === false){
if(false === $databases){
header('location: connection.php?err=1'); header('location: connection.php?err=1');
exit; exit;
} }