You are here

public function ConfigImporter::initialize in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Config/ConfigImporter.php \Drupal\Core\Config\ConfigImporter::initialize()

Initializes the config importer in preparation for processing a batch.

Return value

array An array of \Drupal\Core\Config\ConfigImporter method names and callables that are invoked to complete the import. If there are modules or themes to process then an extra step is added.

Throws

\Drupal\Core\Config\ConfigImporterException If the configuration is already importing.

1 call to ConfigImporter::initialize()
ConfigImporter::import in core/lib/Drupal/Core/Config/ConfigImporter.php
Imports the changelist to the target storage.

File

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

Class

ConfigImporter
Defines a configuration importer.

Namespace

Drupal\Core\Config

Code

public function initialize() {

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

    // Another process is synchronizing configuration.
    throw new ConfigImporterException(sprintf('%s is already importing', static::LOCK_NAME));
  }
  $sync_steps = array();
  $modules = $this
    ->getUnprocessedExtensions('module');
  foreach (array(
    'install',
    'uninstall',
  ) as $op) {
    $this->totalExtensionsToProcess += count($modules[$op]);
  }
  $themes = $this
    ->getUnprocessedExtensions('theme');
  foreach (array(
    'install',
    'uninstall',
  ) as $op) {
    $this->totalExtensionsToProcess += count($themes[$op]);
  }

  // We have extensions to process.
  if ($this->totalExtensionsToProcess > 0) {
    $sync_steps[] = 'processExtensions';
  }
  $sync_steps[] = 'processConfigurations';
  $sync_steps[] = 'processMissingContent';

  // Allow modules to add new steps to configuration synchronization.
  $this->moduleHandler
    ->alter('config_import_steps', $sync_steps, $this);
  $sync_steps[] = 'finish';
  return $sync_steps;
}