installer issues fixed

This commit is contained in:
rahul shukla 2019-03-20 20:27:41 +05:30
parent dc08bbc06e
commit e6ccb45056
5 changed files with 31 additions and 106 deletions

View File

@ -41,17 +41,16 @@ $data = array();
$envFile = $desiredLocation . '/' . '.env';
// reading env content
$str= file_get_contents($envFile);
// converting env content to key/value pair
$data = explode(PHP_EOL,$str);
$data = file($envFile);
$databaseArray = ['DB_HOST', 'DB_DATABASE', 'DB_USERNAME', 'DB_PASSWORD', 'DB_CONNECTION'];
$key = $value = [];
if ($data) {
foreach ($data as $line) {
$line = preg_replace('/\s+/', '', $line);
$rowValues = explode('=', $line);
if (count($rowValues) === 2) {
if (strlen($line) !== 0) {
if (in_array($rowValues[0], $databaseArray)) {
$key[] = $rowValues[0];
$value[] = $rowValues[1];

View File

@ -24,9 +24,6 @@ $data = array();
if (empty($_POST['user_name']))
$errors['user_name'] = 'User Name is required.';
if (empty($_POST['user_password']))
$errors['user_password'] = 'User Password is required.';
if (empty($_POST['port_name']))
$errors['port_name'] = 'Port Name is required.';
@ -82,6 +79,21 @@ $data = array();
}
}
// reading env content
$data = file($envFile);
$keyValueData = [];
if ($data) {
foreach ($data as $line) {
$line = preg_replace('/\s+/', '', $line);
$rowValues = explode('=', $line);
if (strlen($line) !== 0) {
$keyValueData[$rowValues[0]] = $rowValues[1];
}
}
}
// inserting form data to empty array
$keyValueData['DB_HOST'] = $_POST["host_name"];
$keyValueData['DB_DATABASE'] = $_POST["database_name"];
@ -92,33 +104,6 @@ $data = array();
$keyValueData['DB_CONNECTION'] = $_POST["database_connection"];
$keyValueData['DB_PORT'] = $_POST["port_name"];
$keyValueData['APP_ENV'] = $_POST["app_env"];
$keyValueData['APP_KEY'] = $_POST["app_key"];
$keyValueData['APP_DEBUG'] = $_POST["app_debug"];
$keyValueData['LOG_CHANNEL'] = $_POST["log_channel"];
$keyValueData['BROADCAST_DRIVER'] = $_POST["broadcast_driver"];
$keyValueData['CACHE_DRIVER'] = $_POST["cache_driver"];
$keyValueData['SESSION_DRIVER'] = $_POST["session_driver"];
$keyValueData['SESSION_LIFETIME'] = $_POST["session_lifetime"];
$keyValueData['QUEUE_DRIVER'] = $_POST["queue_driver"];
$keyValueData['REDIS_HOST'] = $_POST["redis_host"];
$keyValueData['REDIS_PASSWORD'] = $_POST["redis_password"];
$keyValueData['REDIS_PORT'] = $_POST["redis_port"];
$keyValueData['MAIL_DRIVER'] = $_POST["mail_driver"];
$keyValueData['MAIL_HOST'] = $_POST["mail_host"];
$keyValueData['MAIL_PORT'] = $_POST["mail_port"];
$keyValueData['MAIL_USERNAME'] = $_POST["mail_username"];
$keyValueData['MAIL_PASSWORD'] = $_POST["mail_password"];
$keyValueData['MAIL_ENCRYPTION'] = $_POST["mail_encryption"];
$keyValueData['PUSHER_APP_ID'] = $_POST["pusher_app_id"];
$keyValueData['PUSHER_APP_KEY'] = $_POST["pusher_app_key"];
$keyValueData['PUSHER_APP_SECRET'] = $_POST["pusher_app_secret"];
$keyValueData['PUSHER_APP_CLUSTER'] = $_POST["pusher_app_cluster"];
// making key/value pair with form-data for env
$changedData = [];
foreach ($keyValueData as $key => $value) {

View File

@ -69,37 +69,8 @@
<div class="control-group" id="user_password">
<label for="user_password" class="required">User Password</label>
<input type="text" name="user_password" class="control"
placeholder="database password"
data-validation="length required" data-validation-length="max50">
placeholder="database password">
</div>
<input type="hidden" name="app_env" value="local">
<input type="hidden" name="app_key" value="">
<input type="hidden" name="app_debug" value="true">
<input type="hidden" name="log_channel" value="stack">
<input type="hidden" name="broadcast_driver" value="log">
<input type="hidden" name="cache_driver" value="file">
<input type="hidden" name="session_driver" value="file">
<input type="hidden" name="session_lefetime" value="120">
<input type="hidden" name="queue_driver" value="sync">
<input type="hidden" name="redis_host" value="127.0.0.1">
<input type="hidden" name="redis_password" value="">
<input type="hidden" name="redis_port" value="6379">
<input type="hidden" name="mail_driver" value="smtp">
<input type="hidden" name="mail_host" value="smtp.mailtrap.io">
<input type="hidden" name="mail_port" value="2525">
<input type="hidden" name="mail_username" value="">
<input type="hidden" name="mail_password" value="">
<input type="hidden" name="mail_encryption" value="">
<input type="hidden" name="pusher_app_id" value="">
<input type="hidden" name="pusher_app_key" value="">
<input type="hidden" name="pusher_app_secret" value="">
<input type="hidden" name="pusher_app_cluster" vallue="mt1">
</div>
</div>
<div>
@ -139,34 +110,6 @@
'user_name' : $('input[name=user_name]').val(),
'user_password' : $('input[name=user_password]').val(),
'database_connection' : $("#database_connection" ).val(),
'app_env' : $('input[name=app_env]').val(),
'app_key' : $('input[name=app_key]').val(),
'app_debug' : $('input[name=app_debug]').val(),
'log_channel' : $('input[name=log_channel]').val(),
'broadcast_driver' : $('input[name=broadcast_driver]').val(),
'cache_driver' : $('input[name=cache_driver]').val(),
'session_driver' : $('input[name=session_driver]').val(),
'session_lifetime' : $('input[name=session_lifetime]').val(),
'queue_driver' : $('input[name=queue_driver]').val(),
'redis_host' : $('input[name=redis_host]').val(),
'redis_password' : $('input[name=redis_password]').val(),
'redis_port' : $('input[name=redis_port]').val(),
'mail_driver' : $('input[name=mail_driver]').val(),
'mail_host' : $('input[name=mail_host]').val(),
'mail_port' : $('input[name=mail_port]').val(),
'mail_username' : $('input[name=mail_username]').val(),
'mail_password' : $('input[name=mail_password]').val(),
'mail_encryption' : $('input[name=mail_encryption]').val(),
'pusher_app_id' : $('input[name=pusher_app_id]').val(),
'pusher_app_key' : $('input[name=pusher_app_key]').val(),
'pusher_app_secret' : $('input[name=pusher_app_secret]').val(),
'pusher_app_cluster' : $('input[name=pusher_app_cluster]').val(),
};
var target = window.location.href.concat('/EnvConfig.php');

View File

@ -45,17 +45,16 @@
if (file_exists($envFile)) {
// reading env content
$str= file_get_contents($envFile);
// converting env content to key/value pair
$data = explode(PHP_EOL,$str);
$data = file($envFile);
$databaseArray = ['DB_HOST', 'DB_DATABASE', 'DB_USERNAME', 'DB_PASSWORD', 'DB_CONNECTION','DB_PORT'];
$key = $value = [];
if ($data) {
foreach ($data as $line) {
$line = preg_replace('/\s+/', '', $line);
$rowValues = explode('=', $line);
if (count($rowValues) === 2) {
if (strlen($line) !== 0) {
if (in_array($rowValues[0], $databaseArray)) {
$key[] = $rowValues[0];
$value[] = $rowValues[1];

View File

@ -11,17 +11,16 @@
if (file_exists($envFile)) {
// reading env content
$str = file_get_contents($envFile);
// converting env content to key/value pair
$data = explode(PHP_EOL,$str);
$data = file($envFile);
$databaseArray = ['DB_HOST', 'DB_DATABASE', 'DB_USERNAME', 'DB_PASSWORD', 'DB_CONNECTION','DB_PORT'];
$key = $value = [];
if ($data) {
foreach ($data as $line) {
$line = preg_replace('/\s+/', '', $line);
$rowValues = explode('=', $line);
if (count($rowValues) === 2) {
if (strlen($line) !== 0) {
if (in_array($rowValues[0], $databaseArray)) {
$key[] = $rowValues[0];
$value[] = $rowValues[1];