function i18n_update_9 in Internationalization 6
Drupal 6 upgrade. I have started with the wrong numbering, cannot change it now.
File
- ./
i18n.install, line 63 - Installation file for Internationalization (i18n) module.
Code
function i18n_update_9() {
// Update content type settings
foreach (array_keys(node_get_types()) as $type) {
if (variable_get('i18n_node_' . $type, 0)) {
variable_set('language_content_type_' . $type, TRANSLATION_ENABLED);
}
}
// General language settings
if (variable_get('i18n_browser', 0)) {
variable_set('language_negotiation', LANGUAGE_NEGOTIATION_PATH);
}
else {
variable_set('language_negotiation', LANGUAGE_NEGOTIATION_PATH_DEFAULT);
}
// Set module weight for it to run after core modules
$items[] = update_sql("UPDATE {system} SET weight = 10 WHERE name = 'i18n' AND type = 'module'");
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
// Move node language and trid into node table
$items[] = update_sql("UPDATE {node} n INNER JOIN {i18n_node} i ON n.nid = i.nid SET n.language = i.language, n.tnid = i.trid");
// Upgrade tnid's so they match one of the nodes nid's to avoid
// future conflicts when translating existing nodes
$items[] = update_sql("UPDATE {node} n SET n.tnid = (SELECT MIN(i.nid) FROM {i18n_node} i WHERE i.trid = n.tnid) WHERE n.tnid > 0");
break;
case 'pgsql':
// Move node language and trid into node table
$items[] = update_sql("UPDATE {node} SET language = {i18n_node}.language, tnid = {i18n_node}.trid FROM {i18n_node} WHERE {node}.nid = {i18n_node}.nid");
// Upgrade tnid's so they match one of the nodes nid's to avoid
// future conflicts when translating existing nodes
$items[] = update_sql("UPDATE {node} SET tnid = (SELECT MIN(i.nid) FROM {i18n_node} i WHERE i.trid = {node}.tnid) WHERE tnid > 0");
}
return $items;
}