ConfigImporter::initialize

public function 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;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Config!ConfigImporter.php/function/ConfigImporter::initialize/8.1.x

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部