From 8ae636b4b305786d241c949c1f4891c41c906af4 Mon Sep 17 00:00:00 2001 From: "p.kumar" Date: Wed, 13 Oct 2021 16:13:54 +0530 Subject: [PATCH] update install action handlers --- .../store/install-view/install-view.store.ts | 14 ++++++++++++-- .../Install/Command/LegacyInstallCommand.php | 16 ++++++++++++++-- .../Install/LegacyHandler/InstallHandler.php | 6 ++++-- .../Installation/InstallActionHandler.php | 7 ++++++- 4 files changed, 36 insertions(+), 7 deletions(-) diff --git a/core/app/core/src/lib/views/install/store/install-view/install-view.store.ts b/core/app/core/src/lib/views/install/store/install-view/install-view.store.ts index d70c1add8..1e835f0d1 100644 --- a/core/app/core/src/lib/views/install/store/install-view/install-view.store.ts +++ b/core/app/core/src/lib/views/install/store/install-view/install-view.store.ts @@ -151,7 +151,7 @@ export class InstallViewStore implements StateStore { id: '', module: 'install', attributes: {} - } as Record) + } as Record); } /** @@ -318,7 +318,8 @@ export class InstallViewStore implements StateStore { "db_username", "db_password", "db_host", - "db_name" + "db_name", + "db_port" ], display: "vertical", groupFields: { @@ -354,6 +355,15 @@ export class InstallViewStore implements StateStore { "labelKey": "LBL_DBCONF_DB_NAME", "showLabel": ["*"], "required": true, + }, + "db_port": { + "name": "db_port", + "type": "varchar", + "vname": "LBL_DBCONF_DB_PORT", + "labelKey": "LBL_DBCONF_DB_PORT", + "showLabel": ["*"], + "required": false, + "default": "3306" } }, showLabel: { diff --git a/core/backend/Install/Command/LegacyInstallCommand.php b/core/backend/Install/Command/LegacyInstallCommand.php index 29cf1693c..082ea8415 100644 --- a/core/backend/Install/Command/LegacyInstallCommand.php +++ b/core/backend/Install/Command/LegacyInstallCommand.php @@ -102,6 +102,18 @@ class LegacyInstallCommand extends BaseStepExecutorCommand 'required' => false ]; + $this->inputConfig['db_port'] = [ + 'question' => new Question('Please enter the db port: ', '3306'), + 'argument' => new InputOption( + 'db_port', + 'Z', + InputOption::VALUE_REQUIRED, + 'database port' + ), + 'default' => '3306', + 'required' => false + ]; + $this->inputConfig['db_name'] = [ 'question' => new Question('Please enter the db name: '), 'argument' => new InputOption( @@ -165,12 +177,12 @@ class LegacyInstallCommand extends BaseStepExecutorCommand 'question' => new ChoiceQuestion( 'Ignore system check warnings?: ', ['true', 'false'], - 'true' + 'false' ), 'argument' => new InputOption( 'sys_check_option', 'W', - InputOption::VALUE_OPTIONAL, + InputOption::VALUE_REQUIRED, 'Ignore "system check warnings" during install system acceptance check' ), 'default' => 'false', diff --git a/core/backend/Install/LegacyHandler/InstallHandler.php b/core/backend/Install/LegacyHandler/InstallHandler.php index 6676b4e32..9f5cf37cf 100644 --- a/core/backend/Install/LegacyHandler/InstallHandler.php +++ b/core/backend/Install/LegacyHandler/InstallHandler.php @@ -85,7 +85,8 @@ class InstallHandler extends LegacyHandler LegacyScopeState $legacyScopeState, SessionInterface $session, LoggerInterface $logger - ) { + ) + { parent::__construct( $projectDir, $legacyDir, @@ -222,6 +223,7 @@ class InstallHandler extends LegacyHandler 'export_delimiter' => ',', 'setup_db_admin_password' => $inputArray['db_password'], 'setup_db_admin_user_name' => $inputArray['db_username'], + 'setup_db_port_num' => $inputArray['db_port'], 'setup_db_create_database' => 1, 'setup_db_database_name' => $inputArray['db_name'], 'setup_db_drop_tables' => 0, @@ -260,7 +262,7 @@ class InstallHandler extends LegacyHandler { try { new PDO( - "mysql:host=" . $inputArray["db_host"] . ";", + "mysql:host=" . $inputArray["db_host"] . ":" . $inputArray["db_port"] . ";", $inputArray['db_username'], $inputArray['db_password'] ); diff --git a/core/backend/Install/Service/Installation/InstallActionHandler.php b/core/backend/Install/Service/Installation/InstallActionHandler.php index aba45b772..d02212e39 100644 --- a/core/backend/Install/Service/Installation/InstallActionHandler.php +++ b/core/backend/Install/Service/Installation/InstallActionHandler.php @@ -101,6 +101,10 @@ class InstallActionHandler implements ProcessHandlerInterface $options = $process->getOptions(); + if(empty($options['payload']['db_port'])){ + $options['payload']['db_port'] = '3306'; + } + $validOptions = [ 'site_host', 'demoData', @@ -109,7 +113,8 @@ class InstallActionHandler implements ProcessHandlerInterface 'db_username', 'db_password', 'db_host', - 'db_name' + 'db_name', + 'db_port' ]; foreach ($validOptions as $validOption) {