From 4e1d58feee1df94d0b64682fdb9225e0043e6c13 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 29 May 2010 18:45:31 +0000 Subject: - Patch #812416 by plach: fixed broken upgrade path. --- modules/locale/locale.admin.inc | 8 ++------ modules/locale/locale.install | 24 ++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 8 deletions(-) (limited to 'modules') diff --git a/modules/locale/locale.admin.inc b/modules/locale/locale.admin.inc index da4dcc35d..be25a35a0 100644 --- a/modules/locale/locale.admin.inc +++ b/modules/locale/locale.admin.inc @@ -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); } diff --git a/modules/locale/locale.install b/modules/locale/locale.install index 1bc877c47..6846c3471 100644 --- a/modules/locale/locale.install +++ b/modules/locale/locale.install @@ -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"); } -- cgit v1.2.3