mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-20 21:33:54 -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
|
// Editing ENV file
|
||||||
$DB_HOST = '';
|
$DB_HOST = 'localhost';
|
||||||
$DB_PORT = 3306;
|
$DB_PORT = 3306;
|
||||||
$DB_DATABASE = '';
|
$DB_DATABASE = '';
|
||||||
$DB_USERNAME = '';
|
$DB_USERNAME = '';
|
||||||
|
@ -309,20 +309,17 @@ if (is_file(BB_ROOT . '.env')) {
|
||||||
if (trim($line) !== '' && !str_starts_with($line, '#')) {
|
if (trim($line) !== '' && !str_starts_with($line, '#')) {
|
||||||
$parts = explode('=', $line, 2);
|
$parts = explode('=', $line, 2);
|
||||||
$key = trim($parts[0]);
|
$key = trim($parts[0]);
|
||||||
$value = (isset($parts[1]) && $key !== 'DB_PASSWORD') ? trim($parts[1]) : '';
|
$value = (!empty($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;
|
|
||||||
}
|
|
||||||
|
|
||||||
out("\nCurrent value of $key: $value", 'debug');
|
out("\nCurrent value of $key: $value", 'debug');
|
||||||
echo "Enter a new value for $key (or leave empty to not change): ";
|
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";
|
$line = "$key=$newValue";
|
||||||
$$key = $newValue;
|
$$key = $newValue;
|
||||||
|
} else {
|
||||||
|
$$key = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue