You are here

function lingotek_lingonode_variable_delete_multiple in Lingotek Translation 7.4

Helper function to delete a specified variable from multiple nodes in the Lingotek table

Parameters

int array $nids: array of node ids for the variable that needs to be deleted if a single nid is passed in, it will be converted to an array before processing

string $lingokey: variable name to be deleted

string $condition: additional condition checking (i.e. 'LIKE', '<' '=' '>', etc...) defaults to '='

1 call to lingotek_lingonode_variable_delete_multiple()
lingotek_get_and_update_target_progress in ./lingotek.sync.inc
Updates the 'target_sync_progress_[lang-code]' field for every target in the lingotek table with the overall progress returned by TMS

File

./lingotek.util.inc, line 140
Utility functions.

Code

function lingotek_lingonode_variable_delete_multiple($nids = array(), $lingokey, $condition = '=') {
  if (!is_array($nids)) {
    $nids = array(
      $nids,
    );
  }
  $query = db_select('lingotek', 'l')
    ->fields('l', array(
    'nid',
  ))
    ->condition('nid', $nids, 'IN')
    ->condition('lingokey', $lingokey, $condition);
  $delete_nids = $query
    ->execute()
    ->fetchCol();
  if (!empty($delete_nids)) {
    $delete = db_delete('lingotek')
      ->condition('nid', $delete_nids, 'IN')
      ->condition('lingokey', $lingokey, $condition)
      ->execute();
  }
}