From 92a5b29970e5a511e7c778cf3cb5b30b452827bd Mon Sep 17 00:00:00 2001
From: webchick <webchick@24967.no-reply.drupal.org>
Date: Thu, 11 Oct 2012 14:49:49 -0700
Subject: [PATCH] Issue #1809962 by Jose Reyero, sun: Move some locale updates
 to update.inc for a safe language upgrade.

---
 core/includes/update.inc           | 13 +++++++++++++
 core/modules/locale/locale.install | 13 -------------
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/core/includes/update.inc b/core/includes/update.inc
index 6a7a1a3384c0..fe8034c22e70 100644
--- a/core/includes/update.inc
+++ b/core/includes/update.inc
@@ -399,6 +399,19 @@ function update_prepare_d8_language() {
       // array.
       variable_set('language_default', (array) $language_default);
     }
+
+    // Add column to track customized string status to locales_target.
+    // When updating in a non-English language, the locale translation system is
+    // triggered, which attempts to query string translations already.
+    if (db_table_exists('locales_target') && !db_field_exists('locales_target', 'customized')) {
+      $spec = array(
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0, // LOCALE_NOT_CUSTOMIZED
+        'description' => 'Boolean indicating whether the translation is custom to this site.',
+      );
+      db_add_field('locales_target', 'customized', $spec);
+    }
   }
 }
 
diff --git a/core/modules/locale/locale.install b/core/modules/locale/locale.install
index c73d0ff8866f..30dd78884073 100644
--- a/core/modules/locale/locale.install
+++ b/core/modules/locale/locale.install
@@ -512,19 +512,6 @@ function locale_update_8005() {
   db_add_primary_key('locales_target', array('language', 'lid'));
 }
 
-/**
- * Add column to track customized string status to locales_target.
- */
-function locale_update_8006() {
-  $spec = array(
-    'type' => 'int',
-    'not null' => TRUE,
-    'default' => 0, // LOCALE_NOT_CUSTOMIZED
-    'description' => 'Boolean indicating whether the translation is custom to this site.',
-  );
-  db_add_field('locales_target', 'customized', $spec);
-}
-
 /**
  * Convert language_negotiation_* variables to use the new callbacks.
  *
-- 
GitLab