You are here

function lingotek_migration_1 in Lingotek Translation 7.7

Same name and namespace in other branches
  1. 7.2 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()

Migration 1

2 calls to lingotek_migration_1()
lingotek_install in ./lingotek.install
Implements hook_install().
lingotek_update_7209 in ./lingotek.install
Extend languages table to have lingotek_enabled field

File

./lingotek.util.inc, line 1774
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)
  }

  // store lingotek enabled fields in languages table rather than variable table
  $target_languages = array_filter(explode('|', variable_get('lingotek_target_languages', '')));
  foreach ($target_languages as $drupal_language_code) {
    lingotek_enable_language_by_code($drupal_language_code);
  }
  variable_del('lingotek_target_languages');
  drupal_static_reset('language_list');
}