You are here

function lingotek_migration_1 in Lingotek Translation 7.2

Same name and namespace in other branches
  1. 7.7 lingotek.util.inc \lingotek_migration_1()
  2. 7.3 lingotek.util.inc \lingotek_migration_1()
  3. 7.4 lingotek.util.inc \lingotek_migration_1()
  4. 7.5 lingotek.util.inc \lingotek_migration_1()
  5. 7.6 lingotek.util.inc \lingotek_migration_1()
2 calls to lingotek_migration_1()
lingotek_cleanup_utility in ./lingotek.util.inc
lingotek_update_7209 in ./lingotek.install
Extend languages table to have lingotek_enabled field

File

./lingotek.util.inc, line 942
Utility functions.

Code

function lingotek_migration_1() {
  $spec = array(
    'type' => 'int',
    'description' => "Lingotek enabled",
    'not null' => TRUE,
    'default' => 0,
  );
  try {
    db_add_field('languages', 'lingotek_enabled', $spec);
  } catch (DatabaseSchemaObjectExistsException $e) {

    // already exists (no need to do anything)
  }
  $target_languages = array_filter(explode('|', variable_get('lingotek_target_languages', '')));
  foreach ($target_languages as $drupal_language_code) {
    lingotek_add_target_language(Lingotek::convertDrupal2Lingotek($drupal_language_code), FALSE);
  }
  variable_del('lingotek_target_languages');
  drupal_static_reset('language_list');
}