function ConfigImporter::processConfigurations
Same name in other branches
- 9 core/lib/Drupal/Core/Config/ConfigImporter.php \Drupal\Core\Config\ConfigImporter::processConfigurations()
- 10 core/lib/Drupal/Core/Config/ConfigImporter.php \Drupal\Core\Config\ConfigImporter::processConfigurations()
- 11.x core/lib/Drupal/Core/Config/ConfigImporter.php \Drupal\Core\Config\ConfigImporter::processConfigurations()
Processes configuration as a batch operation.
Parameters
array|\ArrayAccess $context: The batch context.
File
-
core/
lib/ Drupal/ Core/ Config/ ConfigImporter.php, line 594
Class
- ConfigImporter
- Defines a configuration importer.
Namespace
Drupal\Core\ConfigCode
protected function processConfigurations(&$context) {
// The first time this is called we need to calculate the total to process.
// This involves recalculating the changelist which will ensure that if
// extensions have been processed any configuration affected will be taken
// into account.
if ($this->totalConfigurationToProcess == 0) {
$this->storageComparer
->reset();
foreach ($this->storageComparer
->getAllCollectionNames() as $collection) {
foreach ([
'delete',
'create',
'rename',
'update',
] as $op) {
$this->totalConfigurationToProcess += count($this->getUnprocessedConfiguration($op, $collection));
}
}
}
$operation = $this->getNextConfigurationOperation();
if (!empty($operation)) {
if ($this->checkOp($operation['collection'], $operation['op'], $operation['name'])) {
$this->processConfiguration($operation['collection'], $operation['op'], $operation['name']);
}
if ($operation['collection'] == StorageInterface::DEFAULT_COLLECTION) {
$context['message'] = $this->t('Synchronizing configuration: @op @name.', [
'@op' => $operation['op'],
'@name' => $operation['name'],
]);
}
else {
$context['message'] = $this->t('Synchronizing configuration: @op @name in @collection.', [
'@op' => $operation['op'],
'@name' => $operation['name'],
'@collection' => $operation['collection'],
]);
}
$processed_count = 0;
foreach ($this->storageComparer
->getAllCollectionNames() as $collection) {
foreach ([
'delete',
'create',
'rename',
'update',
] as $op) {
$processed_count += count($this->processedConfiguration[$collection][$op]);
}
}
$context['finished'] = $processed_count / $this->totalConfigurationToProcess;
}
else {
$context['finished'] = 1;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.