|
55 | 55 | use Magento\Setup\Module\SetupFactory;
|
56 | 56 | use Magento\Setup\Validator\DbValidator;
|
57 | 57 | use Magento\Store\Model\Store;
|
| 58 | +use Magento\RemoteStorage\Setup\ConfigOptionsList as FileStorageValidator; |
58 | 59 |
|
59 | 60 | /**
|
60 | 61 | * Class Installer contains the logic to install Magento application.
|
@@ -356,6 +357,7 @@ public function install($request)
|
356 | 357 | }
|
357 | 358 | $script[] = ['Installing database schema:', 'installSchema', [$request]];
|
358 | 359 | $script[] = ['Installing search configuration...', 'installSearchConfiguration', [$request]];
|
| 360 | + $script[] = ['Validating file storage configuration...', 'validateFileStorageConfiguration', [$request]]; |
359 | 361 | $script[] = ['Installing user configuration...', 'installUserConfig', [$request]];
|
360 | 362 | $script[] = ['Enabling caches:', 'updateCaches', [true]];
|
361 | 363 | $script[] = ['Installing data...', 'installDataFixtures', [$request]];
|
@@ -1197,6 +1199,25 @@ public function installSearchConfiguration($data)
|
1197 | 1199 | $searchConfig->saveConfiguration($data);
|
1198 | 1200 | }
|
1199 | 1201 |
|
| 1202 | + /** |
| 1203 | + * Validate file storage on install. Since it is a deployment-based configuration, the config is already present, |
| 1204 | + * but this function confirms it can connect (in the case of Remote Storage) after Object Manager |
| 1205 | + * has all necessary dependencies loaded to do so. |
| 1206 | + * |
| 1207 | + * @param array $data |
| 1208 | + * @throws ValidationException |
| 1209 | + * @throws Exception |
| 1210 | + */ |
| 1211 | + public function validateFileStorageConfiguration(array $data) |
| 1212 | + { |
| 1213 | + $fileStorageValidator = $this->objectManagerProvider->get()->get(FileStorageValidator::class); |
| 1214 | + $validationErrors = $fileStorageValidator->validate($data, $this->deploymentConfig); |
| 1215 | + |
| 1216 | + if (!empty($validationErrors)) { |
| 1217 | + throw new ValidationException(__(implode(PHP_EOL, $validationErrors))); |
| 1218 | + } |
| 1219 | + } |
| 1220 | + |
1200 | 1221 | /**
|
1201 | 1222 | * Create data handler
|
1202 | 1223 | *
|
|
0 commit comments