1 system.install system_update_1026()

Convert file system, clean URL, profile, and theme variables to config.

Related topics

File

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

Code

function system_update_1026() {
  $config = config('system.core');
  $config->set('file_additional_public_schemes', update_variable_get('file_additional_public_schemes', array()));
  $config->set('file_default_scheme', update_variable_get('file_default_scheme', 'public'));
  $config->set('file_public_path', update_variable_get('file_public_path', 'files'));
  $config->set('file_temporary_path', update_variable_get('file_temporary_path', ''));
  $config->set('file_private_path', update_variable_get('file_private_path', ''));
  $config->set('image_jpeg_quality', update_variable_get('image_jpeg_quality', 75));

  // Get the Drupal installation profile, and switch it to "standard" if not
  // available in Backdrop.
  $current_profile = update_variable_get('install_profile', 'standard');
  $available_profiles = backdrop_system_listing('/\.profile$/', 'profiles');
  if (!array_key_exists($current_profile, $available_profiles)) {
    $old_profile = $current_profile;
    $current_profile = 'standard';

    // Enable the "standard" profile.
    db_update('system')
      ->fields(array('status' => 1, 'schema_version' => 0))
      ->condition('name', $current_profile)
      ->execute();
    // Disable the old, unavailable/missing profile.
    db_update('system')
      ->fields(array('status' => 0))
      ->condition('name', $old_profile)
      ->execute();
  }
  $config->set('install_profile', $current_profile);

  $config->set('clean_url', update_variable_get('clean_url', 0));
  $config->set('theme_default', update_variable_get('theme_default', 'stark'));
  $config->set('admin_theme', update_variable_get('admin_theme', ''));
  $config->set('node_admin_theme', update_variable_get('node_admin_theme', ''));
  $config->save();

  // Delete variables.
  update_variable_del('file_default_scheme');
  update_variable_del('file_public_path');
  update_variable_del('file_temporary_path');
  update_variable_del('file_private_path');
  update_variable_del('install_profile');
  update_variable_del('clean_url');
  update_variable_del('theme_default');
  update_variable_del('admin_theme');
  update_variable_del('node_admin_theme');
  update_variable_del('image_jpeg_quality');

  // These variables have been converted to settings:
  update_variable_del('css_gzip_compression');
  update_variable_del('js_gzip_compression');

  // And these variables have been converted to state:
  update_variable_del('javascript_parsed');
}