fix install issue with db port

This commit is contained in:
p.kumar 2021-12-10 12:17:04 +00:00
parent 5e4786f60a
commit 724bc50661
4 changed files with 12 additions and 13 deletions

View file

@ -362,8 +362,7 @@ export class InstallViewStore implements StateStore {
"vname": "LBL_DBCONF_DB_PORT",
"labelKey": "LBL_DBCONF_DB_PORT",
"showLabel": ["*"],
"required": false,
"default": "3306"
"required": false
}
},
showLabel: {

View file

@ -101,14 +101,14 @@ class LegacyInstallCommand extends BaseStepExecutorCommand
];
$this->inputConfig['db_port'] = [
'question' => new Question('Please enter the db port: ', '3306'),
'question' => new Question('Please enter the db port: '),
'argument' => new InputOption(
'db_port',
'Z',
InputOption::VALUE_REQUIRED,
'database port'
),
'default' => '3306',
'default' => '',
'required' => false
];

View file

@ -260,9 +260,13 @@ class InstallHandler extends LegacyHandler
*/
public function checkDBConnection(array $inputArray): bool
{
$dbHost = $inputArray["db_host"];
$dbPort = $inputArray["db_port"];
$hostString = !empty($dbPort) ? $dbHost . ':' . $dbPort : $dbHost;
try {
new PDO(
"mysql:host=" . $inputArray["db_host"] . ":" . $inputArray["db_port"] . ";",
"mysql:host=" . $hostString . ";",
$inputArray['db_username'],
$inputArray['db_password']
);
@ -286,9 +290,10 @@ class InstallHandler extends LegacyHandler
$username = urlencode($inputArray['db_username'] ?? '');
$dbName = $inputArray['db_name'] ?? '';
$host = $inputArray['db_host'] ?? '';
$port = $inputArray['db_port'] ?? '3306';
$port = $inputArray['db_port'] ?? '';
$hostString = !empty($port) ? $host . ':' . $port : $host;
$dbUrl = "DATABASE_URL=\"mysql://$username:$password@$host:$port/$dbName\"";
$dbUrl = "DATABASE_URL=\"mysql://$username:$password@$hostString/$dbName\"";
$filesystem = new Filesystem();
try {
chdir($this->projectDir);

View file

@ -101,10 +101,6 @@ class InstallActionHandler implements ProcessHandlerInterface
$options = $process->getOptions();
if(empty($options['payload']['db_port'])){
$options['payload']['db_port'] = '3306';
}
$validOptions = [
'site_host',
'demoData',
@ -113,8 +109,7 @@ class InstallActionHandler implements ProcessHandlerInterface
'db_username',
'db_password',
'db_host',
'db_name',
'db_port'
'db_name'
];
foreach ($validOptions as $validOption) {