You are here

protected function Updater::importConfigs in Update helper 8

Same name and namespace in other branches
  1. 2.x src/Updater.php \Drupal\update_helper\Updater::importConfigs()

Imports configurations.

Parameters

array $config_list: List of full configuration names.

1 call to Updater::importConfigs()
Updater::executeGlobalActions in src/Updater.php
Get array with defined global actions.

File

src/Updater.php, line 263

Class

Updater
Helper class to update configuration.

Namespace

Drupal\update_helper

Code

protected function importConfigs(array $config_list) {

  // Import configurations.
  foreach ($config_list as $full_config_name) {
    $config_name = ConfigName::createByFullName($full_config_name);
    if (!empty($this->configFactory
      ->get($full_config_name)
      ->getRawData())) {
      $this
        ->logWarning($this
        ->t('Importing of @full_name config will be skipped, because configuration already exists.', [
        '@full_name' => $full_config_name,
      ]));
      continue;
    }
    if (!$this->configReverter
      ->import($config_name
      ->getType(), $config_name
      ->getName())) {
      $this
        ->logWarning($this
        ->t('Unable to import @full_name config, because configuration file is not found.', [
        '@full_name' => $full_config_name,
      ]));
      continue;
    }
    $this
      ->logInfo($this
      ->t('Configuration @full_name has been successfully imported.', [
      '@full_name' => $full_config_name,
    ]));
  }
}