1 system.install system_update_1046()

Upgrade or prepare for transliteration functions in core.

Related topics

File

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

Code

function system_update_1046() {
  $config = config('system.core');

  // If contrib module was installed, migrate settings and disable module.
  if (module_exists('transliteration')) {
    $contrib_config = config('transliteration.settings');
    $config->set('file_transliterate_lowercase', $contrib_config->get('file_lowercase'));
    $config->set('file_transliterate_uploads', $contrib_config->get('file_uploads'));
    $config->set('file_transliterate_uploads_display_name', $contrib_config->get('file_uploads_display_name'));

    $path = backdrop_get_path('module', 'transliteration');
    backdrop_set_message(t('Backdrop core now provides transliteration functions in core. A copy of Transliteration module has been located at %path. The module has been disabled, you can remove it safely from your installation.', array('%path' => BACKDROP_ROOT . '/' . $path)), 'warning');
    // Remove the entry for the transliteration module in the system table.
    db_query("DELETE FROM {system} WHERE name = 'transliteration' AND type = 'module'");
  }
  else {
    // Migrate variables to config.
    $config->set('file_transliterate_lowercase', update_variable_get('transliteration_file_lowercase', FALSE));
    $config->set('file_transliterate_uploads', update_variable_get('transliteration_file_uploads', TRUE));
    $config->set('file_transliterate_uploads_display_name', update_variable_get('transliteration_file_uploads_display_name', FALSE));

    // Remove variables from D7.
    update_variable_del('transliteration_file_lowercase');
    update_variable_del('transliteration_file_uploads');
    update_variable_del('transliteration_file_uploads_display_name');

    // Check for files that need to be fixed.
    module_load_include('inc', 'system', 'system.admin');
  }
  $config->save();

  return t('Transliteration has been merged into core. <a href="@transliteration-url">Fix existing file names</a>.', array('@transliteration-url' => url('admin/config/media/file-system/transliteration')));
}