function system_post_update_sort_all_config
Sort all configuration according to its schema.
File
-
core/
modules/ system/ system.post_update.php, line 213
Code
function system_post_update_sort_all_config(&$sandbox) {
$factory = \Drupal::configFactory();
$iteration_size = Settings::get('entity_update_batch_size', 50);
if (empty($sandbox['progress'])) {
$sandbox['progress'] = 0;
$sandbox['all_config_names'] = $factory->listAll();
$sandbox['max'] = count($sandbox['all_config_names']);
}
$start = $sandbox['progress'];
$end = min($sandbox['max'], $start + $iteration_size);
for ($i = $start; $i < $end; $i++) {
try {
$factory->getEditable($sandbox['all_config_names'][$i])
->save();
} catch (\Exception $e) {
watchdog_exception('system', $e);
}
}
if ($sandbox['max'] > 0 && $end < $sandbox['max']) {
$sandbox['progress'] = $end;
$sandbox['#finished'] = ($end - 1) / $sandbox['max'];
}
else {
$sandbox['#finished'] = 1;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.