|
12 | 12 | use Magento\Framework\Setup\Option\FlagConfigOption; |
13 | 13 | use Magento\Framework\Setup\Option\SelectConfigOption; |
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 | /** |
@@ -47,19 +48,28 @@ class ConfigOptionsList implements ConfigOptionsListInterface |
47 | 48 | \Magento\Setup\Model\ConfigOptionsList\PageCache::class |
48 | 49 | ]; |
49 | 50 |
|
| 51 | + /** |
| 52 | + * @var DriverOptions |
| 53 | + */ |
| 54 | + private $driverOptions; |
| 55 | + |
50 | 56 | /** |
51 | 57 | * Constructor |
52 | 58 | * |
53 | 59 | * @param ConfigGenerator $configGenerator |
54 | 60 | * @param DbValidator $dbValidator |
55 | 61 | */ |
56 | | - public function __construct(ConfigGenerator $configGenerator, DbValidator $dbValidator) |
57 | | - { |
| 62 | + public function __construct( |
| 63 | + ConfigGenerator $configGenerator, |
| 64 | + DbValidator $dbValidator, |
| 65 | + DriverOptions $driverOptions = null |
| 66 | + ) { |
58 | 67 | $this->configGenerator = $configGenerator; |
59 | 68 | $this->dbValidator = $dbValidator; |
60 | 69 | foreach ($this->configOptionsListClasses as $className) { |
61 | 70 | $this->configOptionsCollection[] = \Magento\Framework\App\ObjectManager::getInstance()->get($className); |
62 | 71 | } |
| 72 | + $this->driverOptions = $driverOptions ?? \Magento\Framework\App\ObjectManager::getInstance()->get(DriverOptions::class); |
63 | 73 | } |
64 | 74 |
|
65 | 75 | /** |
@@ -150,6 +160,36 @@ public function getOptions() |
150 | 160 | ConfigOptionsListConstants::CONFIG_PATH_CACHE_HOSTS, |
151 | 161 | 'http Cache hosts' |
152 | 162 | ), |
| 163 | + new TextConfigOption( |
| 164 | + ConfigOptionsListConstants::INPUT_KEY_DB_SSL_KEY, |
| 165 | + TextConfigOption::FRONTEND_WIZARD_TEXT, |
| 166 | + ConfigOptionsListConstants::CONFIG_PATH_DB_CONNECTION_DEFAULT_DRIVER_OPTIONS . |
| 167 | + '/' . ConfigOptionsListConstants::KEY_MYSQL_SSL_KEY, |
| 168 | + 'Full path of client key file in order to establish db connection through SSL', |
| 169 | + null |
| 170 | + ), |
| 171 | + new TextConfigOption( |
| 172 | + ConfigOptionsListConstants::INPUT_KEY_DB_SSL_CERT, |
| 173 | + TextConfigOption::FRONTEND_WIZARD_TEXT, |
| 174 | + ConfigOptionsListConstants::CONFIG_PATH_DB_CONNECTION_DEFAULT_DRIVER_OPTIONS . |
| 175 | + '/' . ConfigOptionsListConstants::KEY_MYSQL_SSL_CERT, |
| 176 | + 'Full path of client certificate file in order to establish db connection through SSL', |
| 177 | + null |
| 178 | + ), |
| 179 | + new TextConfigOption( |
| 180 | + ConfigOptionsListConstants::INPUT_KEY_DB_SSL_CA, |
| 181 | + TextConfigOption::FRONTEND_WIZARD_TEXT, |
| 182 | + ConfigOptionsListConstants::CONFIG_PATH_DB_CONNECTION_DEFAULT_DRIVER_OPTIONS . |
| 183 | + '/' . ConfigOptionsListConstants::KEY_MYSQL_SSL_CA, |
| 184 | + 'Full path of server certificate file in order to establish db connection through SSL', |
| 185 | + null |
| 186 | + ), |
| 187 | + new FlagConfigOption( |
| 188 | + ConfigOptionsListConstants::INPUT_KEY_DB_SSL_VERIFY, |
| 189 | + ConfigOptionsListConstants::CONFIG_PATH_DB_CONNECTION_DEFAULT_DRIVER_OPTIONS . |
| 190 | + '/' . ConfigOptionsListConstants::KEY_MYSQL_SSL_VERIFY, |
| 191 | + 'Verify server certification' |
| 192 | + ), |
153 | 193 | ]; |
154 | 194 |
|
155 | 195 | foreach ($this->configOptionsCollection as $configOptionsList) { |
@@ -334,12 +374,14 @@ private function validateDbSettings(array $options, DeploymentConfig $deployment |
334 | 374 | ) { |
335 | 375 | try { |
336 | 376 | $options = $this->getDbSettings($options, $deploymentConfig); |
| 377 | + $driverOptions = $this->driverOptions->getDriverOptions($options); |
337 | 378 |
|
338 | | - $this->dbValidator->checkDatabaseConnection( |
| 379 | + $this->dbValidator->checkDatabaseConnectionWithDriverOptions( |
339 | 380 | $options[ConfigOptionsListConstants::INPUT_KEY_DB_NAME], |
340 | 381 | $options[ConfigOptionsListConstants::INPUT_KEY_DB_HOST], |
341 | 382 | $options[ConfigOptionsListConstants::INPUT_KEY_DB_USER], |
342 | | - $options[ConfigOptionsListConstants::INPUT_KEY_DB_PASSWORD] |
| 383 | + $options[ConfigOptionsListConstants::INPUT_KEY_DB_PASSWORD], |
| 384 | + $driverOptions |
343 | 385 | ); |
344 | 386 | } catch (\Exception $exception) { |
345 | 387 | $errors[] = $exception->getMessage(); |
|
0 commit comments