You are here

function lingotek_batch_keystore_worker in Lingotek Translation 7.7

Same name and namespace in other branches
  1. 7.5 lingotek.batch.inc \lingotek_batch_keystore_worker()
  2. 7.6 lingotek.batch.inc \lingotek_batch_keystore_worker()

Batch worker function for lingotek_keystore operations

1 string reference to 'lingotek_batch_keystore_worker'
lingotek_batch_identify_translations in ./lingotek.util.inc
Batch Create: Lingotek Identify Content - create informative lingotek_entity_ data (in lingotek table) for pre-existing content

File

./lingotek.batch.inc, line 756
Central location for batch create functions, before control is handed off to individual batch command files.

Code

function lingotek_batch_keystore_worker($entity_type, $entity_id, $key, $value, $update_on_dup, &$context) {
  if ($value === LingotekSync::STATUS_UNTRACKED && strpos($key, 'target_sync_status') === 0) {
    $locale = substr($key, strlen('target_sync_status_'));
    $status = LingotekSync::getAllTargetStatusForEntity($entity_type, $entity_id, $locale);
    if (isset($status[$locale]) && $status[$locale] === LingotekSync::STATUS_NONE) {
      $update_on_dup = TRUE;
    }
  }
  $result = lingotek_keystore($entity_type, $entity_id, $key, $value, $update_on_dup);
  $context['message'] = t('Updating tracking information for @et #@eid', array(
    '@et' => $entity_type,
    '@eid' => $entity_id,
  ));
  $context['results'][] = $result;
}