public static function LingotekSync::getDirtySetLids in Lingotek Translation 7.6
Same name and namespace in other branches
- 7.7 lib/Drupal/lingotek/LingotekSync.php \LingotekSync::getDirtySetLids()
1 call to LingotekSync::getDirtySetLids()
- LingotekSync::getDirtyConfigChunks in lib/
Drupal/ lingotek/ LingotekSync.php
File
- lib/
Drupal/ lingotek/ LingotekSync.php, line 531 - LingotekSync
Class
- LingotekSync
- A utility class for Lingotek Syncing.
Code
public static function getDirtySetLids() {
// 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::getLanguagesWithoutSource($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
$textgroups = array_merge(array(
-1,
), LingotekConfigSet::getTextgroupsForTranslation());
$max_length = variable_get('lingotek_config_max_source_length', LINGOTEK_CONFIG_MAX_SOURCE_LENGTH);
$query = db_select('locales_source', 'ls');
$query
->fields('ls', array(
'lid',
))
->condition('ls.source', '', '!=')
->condition('ls.lid', self::getQueryCompletedConfigTranslations($drupal_codes), 'NOT IN')
->where('length(ls.source) < ' . (int) $max_length);
if (in_array('misc', $textgroups)) {
$or = db_or();
$or
->condition('ls.textgroup', $textgroups, 'IN');
$or
->where("ls.textgroup NOT IN ('default','menu','taxonomy','views','blocks','field')");
$query
->condition($or);
}
else {
$query
->condition('ls.textgroup', $textgroups, 'IN');
}
return $query
->execute()
->fetchCol();
}