change method for retrieving all existing databases
This commit is contained in:
@@ -32,7 +32,8 @@ 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() || $checkConnection->getConnection()->query('show databases') === false){
|
$databases = $checkConnection->getConnection()->query('SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA');
|
||||||
|
if(! $checkConnection->exec() || $databases === false){
|
||||||
header('location: connection.php?err=1');
|
header('location: connection.php?err=1');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@@ -48,7 +49,6 @@ else {
|
|||||||
$_SESSION['install']['step'] = 4;
|
$_SESSION['install']['step'] = 4;
|
||||||
$connection = $checkConnection->getConnection();
|
$connection = $checkConnection->getConnection();
|
||||||
|
|
||||||
$databases = $connection->query('show databases');
|
|
||||||
?>
|
?>
|
||||||
<div class="well">
|
<div class="well">
|
||||||
<form action="config.php" method="post">
|
<form action="config.php" method="post">
|
||||||
@@ -59,9 +59,9 @@ $databases = $connection->query('show databases');
|
|||||||
<?php echo $trans->trans('Select below the one you want to use.'); ?>
|
<?php echo $trans->trans('Select below the one you want to use.'); ?>
|
||||||
</p>
|
</p>
|
||||||
<?php foreach($databases as $database): ?>
|
<?php foreach($databases as $database): ?>
|
||||||
<?php if ($database['Database'] == 'information_schema') continue; ?>
|
<?php if ($database['SCHEMA_NAME'] == 'information_schema') continue; ?>
|
||||||
<?php
|
<?php
|
||||||
$connection->exec(sprintf('use %s', $database['Database']));
|
$connection->exec(sprintf('use %s', $database['SCHEMA_NAME']));
|
||||||
|
|
||||||
$tables = $connection->query('SHOW TABLES');
|
$tables = $connection->query('SHOW TABLES');
|
||||||
|
|
||||||
@@ -75,9 +75,9 @@ $databases = $connection->query('show databases');
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
<div class="radio">
|
<div class="radio">
|
||||||
<label for="database_<?php echo $database['Database']; ?>">
|
<label for="database_<?php echo $database['SCHEMA_NAME']; ?>">
|
||||||
<input type="radio" name="database" id="database_<?php echo $database['Database']; ?>" value="<?php echo $database['Database']; ?>" <?php if($found){ echo "disabled"; } ?>>
|
<input type="radio" name="database" id="database_<?php echo $database['SCHEMA_NAME']; ?>" value="<?php echo $database['SCHEMA_NAME']; ?>" <?php if($found){ echo "disabled"; } ?>>
|
||||||
<?php echo $database['Database']; ?>
|
<?php echo $database['SCHEMA_NAME']; ?>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
|||||||
@@ -25,10 +25,12 @@ include 'bootstrap.php';
|
|||||||
|
|
||||||
use Symfony\Component\Translation\Translator;
|
use Symfony\Component\Translation\Translator;
|
||||||
|
|
||||||
if($_REQUEST['lang']){
|
$lang = isset($_REQUEST['lang']) ? $_REQUEST['lang'] : null;
|
||||||
|
|
||||||
|
if($lang){
|
||||||
$_SESSION['install']['lang'] = $_REQUEST['lang'];
|
$_SESSION['install']['lang'] = $_REQUEST['lang'];
|
||||||
}
|
}
|
||||||
elseif(!$_REQUEST['lang'] && !$_SESSION['install']['lang']){
|
elseif(!$lang && !$_SESSION['install']['lang']){
|
||||||
$_SESSION['install']['lang'] = "en_US";
|
$_SESSION['install']['lang'] = "en_US";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user