Commit 4e1d58fe authored by Dries's avatar Dries
Browse files

- Patch #812416 by plach: fixed broken upgrade path.

parent 128a6934
......@@ -519,7 +519,7 @@ function _locale_languages_configure_form_language_table(&$form, $type) {
);
$language_providers = $form['#language_providers'];
$enabled_providers = variable_get("locale_language_providers_enabled_$type", array());
$enabled_providers = variable_get("language_negotiation_$type", array());
$providers_weight = variable_get("locale_language_providers_weight_$type", array());
// Add missing data to the providers lists.
......@@ -527,16 +527,13 @@ function _locale_languages_configure_form_language_table(&$form, $type) {
if (!isset($providers_weight[$id])) {
$providers_weight[$id] = language_provider_weight($provider);
}
if (!isset($enabled_providers[$id])) {
$enabled_providers[$id] = FALSE;
}
}
// Order providers list by weight.
asort($providers_weight);
foreach ($providers_weight as $id => $weight) {
$enabled = $enabled_providers[$id];
$enabled = isset($enabled_providers[$id]);
$provider = $language_providers[$id];
// List the provider only if the current type is defined in its 'types' key.
......@@ -665,7 +662,6 @@ function locale_languages_configure_form_submit($form, &$form_state) {
}
language_negotiation_set($type, $negotiation);
variable_set("locale_language_providers_enabled_$type", $enabled_providers);
variable_set("locale_language_providers_weight_$type", $providers_weight);
}
......
......@@ -56,6 +56,15 @@ function locale_update_7001() {
// LANGUAGE_NEGOTIATION_PATH_DEFAULT.
case 1:
$negotiation = array(LOCALE_LANGUAGE_NEGOTIATION_URL);
// In Drupal 6 path prefixes are shown for the default language only when
// language negotiation is set to LANGUAGE_NEGOTIATION_PATH, while in
// Drupal 7 path prefixes are always shown if not empty. Hence we need to
// ensure that the default language has an empty prefix to avoid breaking
// the site URLs with a prefix that previously was missing.
db_update('languages')
->fields(array('prefix' => ''))
->condition('language', language_default()->language)
->execute();
break;
// LANGUAGE_NEGOTIATION_PATH.
......@@ -70,11 +79,23 @@ function locale_update_7001() {
break;
}
// Save new language negotiation options.
// Save the new language negotiation options.
language_negotiation_set(LANGUAGE_TYPE_INTERFACE, array_flip($negotiation));
language_negotiation_set(LANGUAGE_TYPE_CONTENT, array(LOCALE_LANGUAGE_NEGOTIATION_INTERFACE => 0));
language_negotiation_set(LANGUAGE_TYPE_URL, array(LOCALE_LANGUAGE_NEGOTIATION_URL => 0));
// Save admininstration UI settings.
$type = LANGUAGE_TYPE_INTERFACE;
$provider_weights = array_flip(array_keys(locale_language_negotiation_info()));
variable_set("locale_language_providers_weight_$type", $provider_weights);
// Update language switcher block delta.
db_update('block')
->fields(array('delta' => $type))
->condition('module', 'locale')
->condition('delta', 0)
->execute();
// Unset the old language negotiation system variable.
variable_del('language_negotiation');
......@@ -124,7 +145,6 @@ function locale_uninstall() {
foreach (language_types() as $type) {
variable_del("language_negotiation_$type");
variable_del("locale_language_providers_enabled_$type");
variable_del("locale_language_providers_weight_$type");
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment