mirror of
https://github.com/SuiteCRM/SuiteCRM-Core.git
synced 2025-09-02 08:09:19 +08:00
fix install issue with db port
This commit is contained in:
parent
5e4786f60a
commit
724bc50661
4 changed files with 12 additions and 13 deletions
|
@ -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: {
|
||||
|
|
|
@ -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
|
||||
];
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue