function ConfigImporter::initialize

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Config/ConfigImporter.php \Drupal\Core\Config\ConfigImporter::initialize()
  2. 10 core/lib/Drupal/Core/Config/ConfigImporter.php \Drupal\Core\Config\ConfigImporter::initialize()
  3. 11.x 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 564

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 = [];
    $modules = $this->getUnprocessedExtensions('module');
    foreach ([
        'install',
        'uninstall',
    ] as $op) {
        $this->totalExtensionsToProcess += count($modules[$op]);
    }
    $themes = $this->getUnprocessedExtensions('theme');
    foreach ([
        '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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.