public static function LingotekSync::getTargetCountByDocumentIds in Lingotek Translation 7.4
Same name and namespace in other branches
- 7.7 lib/Drupal/lingotek/LingotekSync.php \LingotekSync::getTargetCountByDocumentIds()
- 7.5 lib/Drupal/lingotek/LingotekSync.php \LingotekSync::getTargetCountByDocumentIds()
- 7.6 lib/Drupal/lingotek/LingotekSync.php \LingotekSync::getTargetCountByDocumentIds()
1 call to LingotekSync::getTargetCountByDocumentIds()
- 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
- lib/
Drupal/ lingotek/ LingotekSync.php, line 458 - LingotekSync
Class
- LingotekSync
- A utility class for Lingotek Syncing.
Code
public static function getTargetCountByDocumentIds($document_ids) {
if (empty($document_ids)) {
return;
}
if (!is_array($document_ids)) {
$document_ids = array(
$document_ids,
);
}
$subquery = db_select('lingotek', 'l1')
->fields('l1', array(
'nid',
))
->condition('l1.lingokey', 'document_id')
->condition('l1.lingovalue', $document_ids, 'IN');
$query = db_select('lingotek', 'l');
$query
->fields('l', array(
'nid',
));
$query
->condition('l.lingokey', 'target_sync_status_%', 'LIKE');
$query
->condition('l.nid', $subquery, 'IN');
$query
->addExpression('COUNT(l.lingokey)', 'targets');
$query
->groupBy('l.nid');
$result = $query
->execute()
->fetchAllAssoc('nid');
return $result;
}