You are here

function lingotek_update_7404 in Lingotek Translation 7.5

Same name and namespace in other branches
  1. 7.7 lingotek.install \lingotek_update_7404()
  2. 7.4 lingotek.install \lingotek_update_7404()
  3. 7.6 lingotek.install \lingotek_update_7404()

Upgrade the callback URL signature and adds translation profiles.

File

./lingotek.install, line 574

Code

function lingotek_update_7404(&$sandbox) {
  LingotekSync::updateNotifyUrl();
  lingotek_extend_metadata_tables();
  $query = db_select('{lingotek}', 'l');
  $query
    ->fields('l', array(
    'nid',
  ));
  $query
    ->distinct('nid');
  $result = $query
    ->execute();
  $nids = $result
    ->fetchCol();
  foreach ($nids as $nid) {
    $profile = lingotek_keystore('node', $nid, 'profile');
    if (empty($profile)) {
      lingotek_keystore('node', $nid, 'profile', LingotekSync::PROFILE_CUSTOM);
    }
  }
  $entity_profiles = variable_get('lingotek_entity_profiles');
  if (empty($entity_profiles)) {
    $fields = variable_get('lingotek_translate_fields');
    $entity_profiles = array();
    foreach (node_type_get_types() as $type => $details) {
      $entity_profiles['node'][$type] = isset($fields[$type]) ? LingotekSync::PROFILE_CUSTOM : LingotekSync::PROFILE_DISABLED;
    }
    variable_set('lingotek_entity_profiles', $entity_profiles);
  }
}