summaryrefslogtreecommitdiff
path: root/modules/locale/locale.install
diff options
context:
space:
mode:
Diffstat (limited to 'modules/locale/locale.install')
-rw-r--r--modules/locale/locale.install38
1 files changed, 38 insertions, 0 deletions
diff --git a/modules/locale/locale.install b/modules/locale/locale.install
index fe1d6b135..2208a2f70 100644
--- a/modules/locale/locale.install
+++ b/modules/locale/locale.install
@@ -163,6 +163,44 @@ function locale_update_6004() {
}
/**
+ * Change language setting variable of content types.
+ *
+ * Use language_content_type_<content_type> instead of language_<content_type>
+ * so content types such as 'default', 'count' or 'negotiation' will not
+ * interfer with language variables.
+ */
+function locale_update_6005() {
+ foreach (node_get_types() as $type => $content_type) {
+ // Default to NULL, so we can skip dealing with non-existent settings.
+ $setting = variable_get('language_'. $type, NULL);
+ if ($type == 'default' && is_numeric($setting)) {
+ // language_default was overwritten with the content type setting,
+ // so reset the default language and save the content type setting.
+ variable_set('language_content_type_default', $setting);
+ variable_del('language_default');
+ drupal_set_message('The default language setting has been reset to its default value. Check the '. l('language configuration page', 'admin/settings/language') .' to configure it correctly.');
+ }
+ elseif ($type == 'negotiation') {
+ // Either it is the negotiation setting or the content type setting, it
+ // is an integer. The language_negotiation setting is not reset, but
+ // the user is alerted that this setting possibly was overwritten
+ variable_set('language_content_type_negotiation', $setting);
+ drupal_set_message('The language negotiation setting was possibly overwritten by a content type of the same name. Check the '. l('language configuration page', 'admin/settings/language/configure') .' and the '. l('<em>'. $content_type->name ."</em> content type's multilingual support settings", 'admin/content/types/negotiation', array('html' => TRUE)) .' to configure them correctly.');
+ }
+ elseif (!is_null($setting)) {
+ // Change the language setting variable for any other content type.
+ // Do not worry about language_count, it will be updated below.
+ variable_set('language_content_type_'. $type, $setting);
+ variable_del('language_'. $type);
+ }
+ }
+ // Update language count variable that might be overwritten.
+ $count = db_result(db_query('SELECT COUNT(*) FROM {languages} WHERE enabled = 1'));
+ variable_set('language_count', $count);
+ return array();
+}
+
+/**
* @} End of "defgroup updates-5.x-to-6.x"
*/