1 config.sync.inc | _config_sync_import(&$context) |
Batch API callback. Import the individual config files.
File
- core/
modules/ config/ config.sync.inc, line 65
Code
function _config_sync_import(&$context) {
// Bail if any errors have been set during validation.
if (isset($context['results']['errors'])) {
$context['finished'] = 1;
return;
}
if (!isset($context['sandbox']['batch_size'])) {
$context['sandbox']['batch_size'] = config_get('system.core', 'config_sync_batch_size');
$context['sandbox']['total_size'] = count($context['results']['pending_changes']);
$context['sandbox']['current_index'] = 0;
}
$config_files = array_slice($context['results']['pending_changes'], 0, $context['sandbox']['batch_size']);
foreach ($config_files as $config_file => $config_change_type) {
config_sync_file($config_file, $config_change_type);
unset($context['results']['pending_changes'][$config_file]);
$context['results']['completed_changes'][$config_file] = $config_change_type;
$context['sandbox']['current_index']++;
}
$context['finished'] = $context['sandbox']['total_size'] ? $context['sandbox']['current_index'] / $context['sandbox']['total_size'] : 1;
}