mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-14 18:48:21 -07:00
misc(installer): Some minor improvements (#1824)
This commit is contained in:
parent
0cfb34ce58
commit
f3714f02f2
1 changed files with 6 additions and 9 deletions
15
install.php
15
install.php
|
@ -288,7 +288,7 @@ if (is_file(BB_ROOT . '.env.example') && !is_file(BB_ROOT . '.env')) {
|
|||
}
|
||||
|
||||
// Editing ENV file
|
||||
$DB_HOST = '';
|
||||
$DB_HOST = 'localhost';
|
||||
$DB_PORT = 3306;
|
||||
$DB_DATABASE = '';
|
||||
$DB_USERNAME = '';
|
||||
|
@ -309,20 +309,17 @@ if (is_file(BB_ROOT . '.env')) {
|
|||
if (trim($line) !== '' && !str_starts_with($line, '#')) {
|
||||
$parts = explode('=', $line, 2);
|
||||
$key = trim($parts[0]);
|
||||
$value = (isset($parts[1]) && $key !== 'DB_PASSWORD') ? trim($parts[1]) : '';
|
||||
|
||||
// Database default values
|
||||
if (in_array($key, ['DB_HOST', 'DB_PORT', 'DB_DATABASE', 'DB_USERNAME', 'DB_PASSWORD'])) {
|
||||
$$key = $value;
|
||||
}
|
||||
$value = (!empty($parts[1]) && $key !== 'DB_PASSWORD') ? trim($parts[1]) : '';
|
||||
|
||||
out("\nCurrent value of $key: $value", 'debug');
|
||||
echo "Enter a new value for $key (or leave empty to not change): ";
|
||||
$newValue = readline();
|
||||
$newValue = trim(readline());
|
||||
|
||||
if (!empty($newValue) || $key === 'DB_PASSWORD') {
|
||||
if (!empty($newValue)) {
|
||||
$line = "$key=$newValue";
|
||||
$$key = $newValue;
|
||||
} else {
|
||||
$$key = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue