From dc08bbc06e92db8d25a98521ba47b47cf231217a Mon Sep 17 00:00:00 2001 From: rahul shukla Date: Wed, 20 Mar 2019 15:09:24 +0530 Subject: [PATCH] installer issue --- .../views/catalog/products/create.blade.php | 2 +- public/installer/EnvConfig.php | 46 +++++++++------- public/installer/Environment.php | 55 +++++++++++++++++++ public/installer/index.php | 2 +- public/installer/install.php | 6 +- 5 files changed, 88 insertions(+), 23 deletions(-) diff --git a/packages/Webkul/Admin/src/Resources/views/catalog/products/create.blade.php b/packages/Webkul/Admin/src/Resources/views/catalog/products/create.blade.php index 6ff023a32..af2f7e409 100755 --- a/packages/Webkul/Admin/src/Resources/views/catalog/products/create.blade.php +++ b/packages/Webkul/Admin/src/Resources/views/catalog/products/create.blade.php @@ -55,7 +55,7 @@ diff --git a/public/installer/EnvConfig.php b/public/installer/EnvConfig.php index 3e912efa7..9f3e24bc2 100755 --- a/public/installer/EnvConfig.php +++ b/public/installer/EnvConfig.php @@ -82,25 +82,6 @@ $data = array(); } } - // reading env content - $str= file_get_contents($envFile); - - // converting env content to key/value pair - $data = explode(PHP_EOL,$str); - $keyValueData = []; - - if ($data) { - foreach ($data as $line) { - $rowValues = explode('=', $line); - if (count($rowValues) === 2) { - $keyValueData[$rowValues[0]] = $rowValues[1]; - } else if (count($rowValues) > 2) { - $eqPos = strpos($line, '='); - $keyValueData[substr($line, 0, $eqPos)] = substr($line,$eqPos+1); - } - } - } - // inserting form data to empty array $keyValueData['DB_HOST'] = $_POST["host_name"]; $keyValueData['DB_DATABASE'] = $_POST["database_name"]; @@ -111,6 +92,33 @@ $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) { diff --git a/public/installer/Environment.php b/public/installer/Environment.php index ecaae47ac..20f2a3453 100755 --- a/public/installer/Environment.php +++ b/public/installer/Environment.php @@ -72,6 +72,34 @@ placeholder="database password" data-validation="length required" data-validation-length="max50"> + + + + + + + + + + + + + + + + + + + + + + + + + + + +
@@ -112,6 +140,33 @@ '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'); diff --git a/public/installer/index.php b/public/installer/index.php index 58a459130..8916352f1 100755 --- a/public/installer/index.php +++ b/public/installer/index.php @@ -85,7 +85,7 @@ $result = $conn->query($sql); if ($result) { - $installed = true; + $installed = true; } } diff --git a/public/installer/install.php b/public/installer/install.php index c70b85044..b597ab0a9 100755 --- a/public/installer/install.php +++ b/public/installer/install.php @@ -21,7 +21,6 @@ if ($data) { foreach ($data as $line) { $rowValues = explode('=', $line); - if (count($rowValues) === 2) { if (in_array($rowValues[0], $databaseArray)) { $key[] = $rowValues[0]; @@ -75,4 +74,7 @@ } else { return null; } -?> \ No newline at end of file +?> + + +