public function ConfigImporter::import

Imports the changelist to the target storage.

Return value

\Drupal\Core\Config\ConfigImporter The ConfigImporter instance.

Throws

\Drupal\Core\Config\ConfigException

File

drupal/core/lib/Drupal/Core/Config/ConfigImporter.php, line 211
Contains \Drupal\Core\Config\ConfigImporter.

Class

ConfigImporter
Defines a configuration importer.

Namespace

Drupal\Core\Config

Code

public function import() {
  if ($this
    ->hasUnprocessedChanges()) {

    // Ensure that the changes have been validated.
    $this
      ->validate();
    $this->configFactory
      ->enterContext($this->context);
    if (!$this->lock
      ->acquire(static::ID)) {

      // Another process is synchronizing configuration.
      throw new ConfigImporterException(sprintf('%s is already importing', static::ID));
    }
    $this
      ->importInvokeOwner();
    $this
      ->importConfig();

    // Allow modules to react to a import.
    $this
      ->notify('import');

    // The import is now complete.
    $this->lock
      ->release(static::ID);
    $this
      ->reset();

    // Leave the context used during import and clear the ConfigFactory's
    // static cache.
    $this->configFactory
      ->leaveContext()
      ->reset();
  }
  return $this;
}