function node_update_8003

Rename node type language variable names.

Related topics

File

drupal/core/modules/node/node.install, line 608
Install, update and uninstall functions for the node module.

Code

function node_update_8003() {
  $types = db_query('SELECT type FROM {node_type}')
    ->fetchCol();
  foreach ($types as $type) {
    update_variable_set('node_type_language_default_' . $type, Language::LANGCODE_NOT_SPECIFIED);
    $node_type_language = update_variable_get('node_type_language_' . $type, 0);
    if ($node_type_language == 0) {
      update_variable_set('node_type_language_show_' . $type, FALSE);
    }
    if ($node_type_language == 2) {

      // Translation was enabled, so enable it again and
      // unhide the language selector. Because if language is
      // Language::LANGCODE_NOT_SPECIFIED and the selector hidden, translation
      // cannot be enabled.
      update_variable_set('node_type_language_show_' . $type, TRUE);
      update_variable_set('node_type_language_translation_enabled_' . $type, TRUE);
    }
    update_variable_del('node_type_language_' . $type);
  }
}