You are here

function lingotek_batch_disassociate_content in Lingotek Translation 7.4

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

Batch Create: Lingotek Disassociate Translations

1 string reference to 'lingotek_batch_disassociate_content'
lingotek_admin_utilities_form in ./lingotek.admin.inc
Utilities Form

File

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

Code

function lingotek_batch_disassociate_content() {
  $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::disassociateAllNodes',
    array(),
  );
  $operations[] = array(
    'LingotekSync::disassociateAllEntities',
    array(),
  );
  $operations[] = array(
    'LingotekSync::disassociateAllChunks',
    array(),
  );
  drupal_set_message(t('All local translations have been disassociated from Lingotek.'));
  $operations[] = array(
    'lingotek_cleanup_utility',
    array(
      FALSE,
      FALSE,
    ),
  );

  // identify translatable content
  drupal_set_message(t('Translation management settings for all nodes have been set to the defaults.'));
  $batch = array(
    'title' => t('Disassociating Translations'),
    'operations' => $operations,
  );
  batch_set($batch);
  batch_process('admin/settings/lingotek/settings');
}