You are here

function lingotek_batch_disassociate_content in Lingotek Translation 7.5

Same name and namespace in other branches
  1. 7.7 lingotek.batch.inc \lingotek_batch_disassociate_content()
  2. 7.4 lingotek.batch.inc \lingotek_batch_disassociate_content()
  3. 7.6 lingotek.batch.inc \lingotek_batch_disassociate_content()

Batch Create: Lingotek Disassociate Translations

File

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

Code

function lingotek_batch_disassociate_content($remove_from_TMS) {
  $doc_ids = LingotekSync::getAllLocalDocIds();
  $api = LingotekApi::instance();
  $operations = array();

  /*
   //one at a time
   foreach ($doc_ids as $doc_id) {
   $operations[] = array('lingotek_batch_disassociate_content_worker', array($api, $doc_id));
   }
  */

  // all at once
  $operations[] = array(
    'lingotek_batch_disassociate_content_worker',
    array(
      $api,
      $doc_ids,
    ),
  );
  $operations[] = array(
    'LingotekSync::disassociateAllEntities',
    array(),
  );
  $operations[] = array(
    'LingotekSync::disassociateAllChunks',
    array(),
  );
  drupal_set_message(t('All local translations have been disassociated from Lingotek.'));
  $batch = array(
    'title' => t('Disassociating Translations'),
    'operations' => $operations,
  );
  batch_set($batch);
  batch_process('admin/settings/lingotek/settings');
}