You are here

public static function LingotekSync::getDirtyChunkLids in Lingotek Translation 7.3

Same name and namespace in other branches
  1. 7.4 lib/Drupal/lingotek/LingotekSync.php \LingotekSync::getDirtyChunkLids()
  2. 7.5 lib/Drupal/lingotek/LingotekSync.php \LingotekSync::getDirtyChunkLids()
2 calls to LingotekSync::getDirtyChunkLids()
LingotekSync::getChunkCountByStatus in lib/Drupal/lingotek/LingotekSync.php
LingotekSync::getDirtyConfigChunks in lib/Drupal/lingotek/LingotekSync.php

File

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

Class

LingotekSync
A utility class for Lingotek Syncing.

Code

public static function getDirtyChunkLids() {

  // return the list of all lids from the locale_source table *not* fully translated
  $source_language = language_default();
  if (!isset($source_language->lingotek_locale)) {
    $source_language->lingotek_locale = Lingotek::convertDrupal2Lingotek($source_language->language);
  }
  $lingotek_codes = Lingotek::availableLanguageTargetsWithoutSource($source_language->lingotek_locale);
  if (!count($lingotek_codes)) {
    LingotekLog::error('No languages configured for this Lingotek account.', array());
    return array();
  }

  // get the drupal language for each associated lingotek locale
  $drupal_codes = array();
  foreach ($lingotek_codes as $lc) {
    $drupal_codes[] = Lingotek::convertLingotek2Drupal($lc);
  }

  // get the list of all segments that need updating
  // that belong to the textgroups the user wants translated
  $query = db_select('locales_source', 'ls');
  $query
    ->fields('ls', array(
    'lid',
  ))
    ->condition('ls.source', '', '!=')
    ->condition('ls.textgroup', LingotekConfigChunk::getTextgroupsForTranslation(), 'IN')
    ->condition('ls.lid', self::getQueryCompletedConfigTranslations($drupal_codes), 'NOT IN');
  return $query
    ->execute()
    ->fetchCol();
}