ConfigImporter::initialize

public 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.

File

core/lib/Drupal/Core/Config/ConfigImporter.php, line 511

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;
}
doc_Drupal
2016-10-29 08:53:41
Comments
Leave a Comment

Please login to continue.