mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 20:17:24 +08:00
fix: update create env overwrite exists env
This commit is contained in:
@@ -408,13 +408,20 @@ class Install
|
|||||||
if (file_exists($envFile) && is_readable($envFile)) {
|
if (file_exists($envFile) && is_readable($envFile)) {
|
||||||
//already exists, read it ,and merge post data
|
//already exists, read it ,and merge post data
|
||||||
$newData = readEnvFile($envFile);
|
$newData = readEnvFile($envFile);
|
||||||
|
$this->doLog("[CREATE ENV] .env exists, data: " . json_encode($newData));
|
||||||
}
|
}
|
||||||
|
$this->doLog("[CREATE ENV] newData: " . json_encode($newData));
|
||||||
foreach ($envExampleData as $key => $value) {
|
foreach ($envExampleData as $key => $value) {
|
||||||
if (isset($data[$key])) {
|
if (isset($data[$key])) {
|
||||||
$value = trim($data[$key]);
|
$value = trim($data[$key]);
|
||||||
|
$this->doLog("[CREATE ENV] key: $key, new value: $value from post.");
|
||||||
|
$newData[$key] = $value;
|
||||||
|
} elseif (!isset($newData[$key])) {
|
||||||
|
$this->doLog("[CREATE ENV] key: $key, new value: $value from example.");
|
||||||
|
$newData[$key] = $value;
|
||||||
}
|
}
|
||||||
$newData[$key] = $value;
|
|
||||||
}
|
}
|
||||||
|
$this->doLog("[CREATE ENV] final newData: " . json_encode($newData));
|
||||||
unset($key, $value);
|
unset($key, $value);
|
||||||
mysql_connect($newData['MYSQL_HOST'], $newData['MYSQL_USERNAME'], $newData['MYSQL_PASSWORD'], $newData['MYSQL_DATABASE'], $newData['MYSQL_PORT']);
|
mysql_connect($newData['MYSQL_HOST'], $newData['MYSQL_USERNAME'], $newData['MYSQL_PASSWORD'], $newData['MYSQL_DATABASE'], $newData['MYSQL_PORT']);
|
||||||
if (extension_loaded('redis') && !empty($newData['REDIS_HOST'])) {
|
if (extension_loaded('redis') && !empty($newData['REDIS_HOST'])) {
|
||||||
|
|||||||
Reference in New Issue
Block a user