function i18n_string_update_7000 in Internationalization 7
Populate fields from old locale table (textgroup, location) and drop indexes from locales_source
1 call to i18n_string_update_7000()
- i18n_string_install in i18n_string/
i18n_string.install - Implements hook_install().
File
- i18n_string/
i18n_string.install, line 215 - Installation file for i18n_string module.
Code
function i18n_string_update_7000() {
// @todo Update from d6
variable_del('i18nstrings_allowed_textgroups');
// If we've got old table from D6, move data to new one
if (db_table_exists('i18n_strings')) {
// First of all clean up strings that don't have a locale source, see http://drupal.org/node/1186692
db_query("DELETE FROM {i18n_strings} WHERE lid NOT IN (SELECT lid FROM {locales_source})");
db_query("INSERT INTO {i18n_string}(lid, objectid, type, property, objectindex, format) SELECT lid, objectid, type, property, objectindex, format FROM {i18n_strings}");
// Update and populate textgroup field
db_query("UPDATE {i18n_string} s SET s.textgroup = (SELECT l.textgroup FROM {locales_source} l WHERE l.lid = s.lid)");
// Populate context field. We could use CONCAT_WS but I guess this is more standard.
db_query("UPDATE {i18n_string} SET context = CONCAT(type, ':', objectid, ':', property)");
db_query("UPDATE {locales_source} s INNER JOIN {i18n_string} i ON s.lid = i.lid SET s.context = i.context");
}
}