Language type 'language' renamed to 'language_interface'.
function locale_update_8001() {
// Only change language_types if we had this setting saved. Keep order
// of types because that is significant for value dependency.
$types = update_variable_get('language_types', NULL);
if (!empty($types) && isset($types['language'])) {
$new_types = array();
foreach ($types as $key => $type) {
$new_types[$key == 'language' ? 'language_interface' : $key] = $type;
}
update_variable_set('language_types', $new_types);
}
// Rename language_negotiation_language setting if exists.
$setting = update_variable_get('language_negotiation_language', NULL);
if ($setting !== NULL) {
update_variable_set('language_negotiation_language_interface', $setting);
update_variable_del('language_negotiation_language');
}
// Rename locale_language_providers_weight_language setting if exists.
$weight = update_variable_get('locale_language_providers_weight_language', NULL);
if ($weight !== NULL) {
update_variable_set('locale_language_providers_weight_language_interface', $weight);
update_variable_del('locale_language_providers_weight_language');
}
// Update block data in all core block related tables. Contributed modules
// storing data for blocks will need to update for themselves.
$block_tables = array(
'block',
'block_node_type',
'block_role',
);
foreach ($block_tables as $table) {
// Perform the update only if the language switcher block data is available.
$block_data = db_query_range('SELECT 1 FROM {' . $table . '} WHERE delta = :delta AND module = :module', 0, 1, array(
':delta' => 'language',
':module' => 'locale',
))
->fetchField();
if ($block_data) {
// If block information is rebuilt before performing the update, we might
// already have data for the new delta. In this case we need to remove it
// to avoid integrity constraint violation errors.
db_delete($table)
->condition('delta', 'language_interface')
->condition('module', 'locale')
->execute();
db_update($table)
->fields(array(
'delta' => 'language_interface',
))
->condition('delta', 'language')
->condition('module', 'locale')
->execute();
}
}
}