You are here

public static function LingotekSync::getTargetChunkCountByStatus in Lingotek Translation 7.4

Same name and namespace in other branches
  1. 7.7 lib/Drupal/lingotek/LingotekSync.php \LingotekSync::getTargetChunkCountByStatus()
  2. 7.3 lib/Drupal/lingotek/LingotekSync.php \LingotekSync::getTargetChunkCountByStatus()
  3. 7.5 lib/Drupal/lingotek/LingotekSync.php \LingotekSync::getTargetChunkCountByStatus()
  4. 7.6 lib/Drupal/lingotek/LingotekSync.php \LingotekSync::getTargetChunkCountByStatus()

File

lib/Drupal/lingotek/LingotekSync.php, line 425
LingotekSync

Class

LingotekSync
A utility class for Lingotek Syncing.

Code

public static function getTargetChunkCountByStatus($status, $lingotek_locale) {
  $target_prefix = 'target_sync_status_';
  $target_key = $target_prefix . $lingotek_locale;
  $query = db_select('lingotek_config_metadata', 'l')
    ->fields('l');
  $query
    ->condition('value', $status);
  $query
    ->condition('config_key', $target_key);
  $count = 0;
  $result = $query
    ->countQuery()
    ->execute()
    ->fetchAssoc();
  if (is_array($result)) {
    $count = array_shift($result);
  }
  return $count;
}