protected function ConfigImporterService::import in Config Importer and Tools 8.0
Same name and namespace in other branches
- 8.2 src/ConfigImporterService.php \Drupal\config_import\ConfigImporterService::import()
- 8 src/ConfigImporterService.php \Drupal\config_import\ConfigImporterService::import()
Import config from temporary directory.
Parameters
string $dir: Temporary directory.
1 call to ConfigImporterService::import()
- ConfigImporterService::importConfigs in src/
ConfigImporterService.php - Import config files.
File
- src/
ConfigImporterService.php, line 184
Class
- ConfigImporterService
- Class ConfigImporterService.
Namespace
Drupal\config_importCode
protected function import($dir) {
$source_storage = new FileStorage($dir);
$storage_comparer = new StorageComparer($source_storage, $this->configStorage, $this->configManager);
if (!$storage_comparer
->createChangelist()
->hasChanges()) {
return;
}
$config_importer = new ConfigImporter($storage_comparer, $this->eventDispatcher, $this->configManager, $this->lock, $this->configTyped, $this->moduleHandler, $this->moduleInstaller, $this->themeHandler, $this->translationManager);
try {
$config_importer
->validate();
$config_importer
->import();
} catch (ConfigException $e) {
$message = 'The import failed due for the following reasons:' . "\n";
$message .= implode("\n", $config_importer
->getErrors());
throw new ConfigImporterException($message);
}
}