1 system.install system_update_1024()

Consolidate common config files into "system.core".

Related topics

File

core/modules/system/system.install, line 2246
Install, update and uninstall functions for the system module.

Code

function system_update_1024() {
  // This update only affects HEAD2HEAD upgrades, as system.core is used in all
  // previous updates instead of the old files names updated here.
  $core_config = config('system.core');
  if (!$core_config->isNew()) {
    return;
  }

  $files_to_upgrade = array(
    'system.site',
    'system.rss',
    'system.performance',
    'system.menu',
    'system.maintenance',
    'system.logging',
    'system.cron',
    'user.settings',
  );

  $combined_data = array();
  foreach ($files_to_upgrade as $file) {
    $config = config($file);
    if ($config_data = $config->get()) {
      $combined_data = array_merge($combined_data, $config_data);
    }
    $config->delete();
  }
  $combined_data['_config_name'] = 'system.core';
  $combined_data['_config_static'] = TRUE;
  ksort($combined_data);

  $core_config->setData($combined_data);
  $core_config->save();
}