12
12
use Magento \Framework \Setup \ConfigOptionsListInterface ;
13
13
use Magento \Framework \Setup \Option \FlagConfigOption ;
14
14
use Magento \Framework \Setup \Option \TextConfigOption ;
15
+ use Magento \Setup \Model \ConfigOptionsList \DriverOptions ;
15
16
use Magento \Setup \Validator \DbValidator ;
16
17
17
18
/**
@@ -53,17 +54,24 @@ class ConfigOptionsList implements ConfigOptionsListInterface
53
54
\Magento \Setup \Model \ConfigOptionsList \Lock::class,
54
55
];
55
56
57
+ /**
58
+ * @var DriverOptions
59
+ */
60
+ private $ driverOptions ;
61
+
56
62
/**
57
63
* Constructor
58
64
*
59
65
* @param ConfigGenerator $configGenerator
60
66
* @param DbValidator $dbValidator
61
67
* @param KeyValidator|null $encryptionKeyValidator
68
+ * @param DriverOptions|null $driverOptions
62
69
*/
63
70
public function __construct (
64
71
ConfigGenerator $ configGenerator ,
65
72
DbValidator $ dbValidator ,
66
- KeyValidator $ encryptionKeyValidator = null
73
+ KeyValidator $ encryptionKeyValidator = null ,
74
+ DriverOptions $ driverOptions = null
67
75
) {
68
76
$ this ->configGenerator = $ configGenerator ;
69
77
$ this ->dbValidator = $ dbValidator ;
@@ -72,6 +80,7 @@ public function __construct(
72
80
$ this ->configOptionsCollection [] = $ objectManager ->get ($ className );
73
81
}
74
82
$ this ->encryptionKeyValidator = $ encryptionKeyValidator ?: $ objectManager ->get (KeyValidator::class);
83
+ $ this ->driverOptions = $ driverOptions ?? $ objectManager ->get (DriverOptions::class);
75
84
}
76
85
77
86
/**
@@ -162,6 +171,36 @@ public function getOptions()
162
171
ConfigOptionsListConstants::CONFIG_PATH_CACHE_HOSTS ,
163
172
'http Cache hosts '
164
173
),
174
+ new TextConfigOption (
175
+ ConfigOptionsListConstants::INPUT_KEY_DB_SSL_KEY ,
176
+ TextConfigOption::FRONTEND_WIZARD_TEXT ,
177
+ ConfigOptionsListConstants::CONFIG_PATH_DB_CONNECTION_DEFAULT_DRIVER_OPTIONS .
178
+ '/ ' . ConfigOptionsListConstants::KEY_MYSQL_SSL_KEY ,
179
+ 'Full path of client key file in order to establish db connection through SSL ' ,
180
+ null
181
+ ),
182
+ new TextConfigOption (
183
+ ConfigOptionsListConstants::INPUT_KEY_DB_SSL_CERT ,
184
+ TextConfigOption::FRONTEND_WIZARD_TEXT ,
185
+ ConfigOptionsListConstants::CONFIG_PATH_DB_CONNECTION_DEFAULT_DRIVER_OPTIONS .
186
+ '/ ' . ConfigOptionsListConstants::KEY_MYSQL_SSL_CERT ,
187
+ 'Full path of client certificate file in order to establish db connection through SSL ' ,
188
+ null
189
+ ),
190
+ new TextConfigOption (
191
+ ConfigOptionsListConstants::INPUT_KEY_DB_SSL_CA ,
192
+ TextConfigOption::FRONTEND_WIZARD_TEXT ,
193
+ ConfigOptionsListConstants::CONFIG_PATH_DB_CONNECTION_DEFAULT_DRIVER_OPTIONS .
194
+ '/ ' . ConfigOptionsListConstants::KEY_MYSQL_SSL_CA ,
195
+ 'Full path of server certificate file in order to establish db connection through SSL ' ,
196
+ null
197
+ ),
198
+ new FlagConfigOption (
199
+ ConfigOptionsListConstants::INPUT_KEY_DB_SSL_VERIFY ,
200
+ ConfigOptionsListConstants::CONFIG_PATH_DB_CONNECTION_DEFAULT_DRIVER_OPTIONS .
201
+ '/ ' . ConfigOptionsListConstants::KEY_MYSQL_SSL_VERIFY ,
202
+ 'Verify server certification '
203
+ ),
165
204
];
166
205
167
206
foreach ($ this ->configOptionsCollection as $ configOptionsList ) {
@@ -349,12 +388,14 @@ private function validateDbSettings(array $options, DeploymentConfig $deployment
349
388
) {
350
389
try {
351
390
$ options = $ this ->getDbSettings ($ options , $ deploymentConfig );
391
+ $ driverOptions = $ this ->driverOptions ->getDriverOptions ($ options );
352
392
353
- $ this ->dbValidator ->checkDatabaseConnection (
393
+ $ this ->dbValidator ->checkDatabaseConnectionWithDriverOptions (
354
394
$ options [ConfigOptionsListConstants::INPUT_KEY_DB_NAME ],
355
395
$ options [ConfigOptionsListConstants::INPUT_KEY_DB_HOST ],
356
396
$ options [ConfigOptionsListConstants::INPUT_KEY_DB_USER ],
357
- $ options [ConfigOptionsListConstants::INPUT_KEY_DB_PASSWORD ]
397
+ $ options [ConfigOptionsListConstants::INPUT_KEY_DB_PASSWORD ],
398
+ $ driverOptions
358
399
);
359
400
} catch (\Exception $ exception ) {
360
401
$ errors [] = $ exception ->getMessage ();
0 commit comments