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",
|
"vname": "LBL_DBCONF_DB_PORT",
|
||||||
"labelKey": "LBL_DBCONF_DB_PORT",
|
"labelKey": "LBL_DBCONF_DB_PORT",
|
||||||
"showLabel": ["*"],
|
"showLabel": ["*"],
|
||||||
"required": false,
|
"required": false
|
||||||
"default": "3306"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
showLabel: {
|
showLabel: {
|
||||||
|
|
|
@ -101,14 +101,14 @@ class LegacyInstallCommand extends BaseStepExecutorCommand
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->inputConfig['db_port'] = [
|
$this->inputConfig['db_port'] = [
|
||||||
'question' => new Question('Please enter the db port: ', '3306'),
|
'question' => new Question('Please enter the db port: '),
|
||||||
'argument' => new InputOption(
|
'argument' => new InputOption(
|
||||||
'db_port',
|
'db_port',
|
||||||
'Z',
|
'Z',
|
||||||
InputOption::VALUE_REQUIRED,
|
InputOption::VALUE_REQUIRED,
|
||||||
'database port'
|
'database port'
|
||||||
),
|
),
|
||||||
'default' => '3306',
|
'default' => '',
|
||||||
'required' => false
|
'required' => false
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -260,9 +260,13 @@ class InstallHandler extends LegacyHandler
|
||||||
*/
|
*/
|
||||||
public function checkDBConnection(array $inputArray): bool
|
public function checkDBConnection(array $inputArray): bool
|
||||||
{
|
{
|
||||||
|
$dbHost = $inputArray["db_host"];
|
||||||
|
$dbPort = $inputArray["db_port"];
|
||||||
|
$hostString = !empty($dbPort) ? $dbHost . ':' . $dbPort : $dbHost;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
new PDO(
|
new PDO(
|
||||||
"mysql:host=" . $inputArray["db_host"] . ":" . $inputArray["db_port"] . ";",
|
"mysql:host=" . $hostString . ";",
|
||||||
$inputArray['db_username'],
|
$inputArray['db_username'],
|
||||||
$inputArray['db_password']
|
$inputArray['db_password']
|
||||||
);
|
);
|
||||||
|
@ -286,9 +290,10 @@ class InstallHandler extends LegacyHandler
|
||||||
$username = urlencode($inputArray['db_username'] ?? '');
|
$username = urlencode($inputArray['db_username'] ?? '');
|
||||||
$dbName = $inputArray['db_name'] ?? '';
|
$dbName = $inputArray['db_name'] ?? '';
|
||||||
$host = $inputArray['db_host'] ?? '';
|
$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();
|
$filesystem = new Filesystem();
|
||||||
try {
|
try {
|
||||||
chdir($this->projectDir);
|
chdir($this->projectDir);
|
||||||
|
|
|
@ -101,10 +101,6 @@ class InstallActionHandler implements ProcessHandlerInterface
|
||||||
|
|
||||||
$options = $process->getOptions();
|
$options = $process->getOptions();
|
||||||
|
|
||||||
if(empty($options['payload']['db_port'])){
|
|
||||||
$options['payload']['db_port'] = '3306';
|
|
||||||
}
|
|
||||||
|
|
||||||
$validOptions = [
|
$validOptions = [
|
||||||
'site_host',
|
'site_host',
|
||||||
'demoData',
|
'demoData',
|
||||||
|
@ -113,8 +109,7 @@ class InstallActionHandler implements ProcessHandlerInterface
|
||||||
'db_username',
|
'db_username',
|
||||||
'db_password',
|
'db_password',
|
||||||
'db_host',
|
'db_host',
|
||||||
'db_name',
|
'db_name'
|
||||||
'db_port'
|
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($validOptions as $validOption) {
|
foreach ($validOptions as $validOption) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue