function lingotek_sync_download_chunk_target in Lingotek Translation 7.4
Same name and namespace in other branches
- 7.3 lingotek.batch.inc \lingotek_sync_download_chunk_target()
- 7.5 lingotek.batch.inc \lingotek_sync_download_chunk_target()
1 string reference to 'lingotek_sync_download_chunk_target'
- lingotek_get_sync_download_batch_elements in ./
lingotek.batch.inc - Sync - Download Batch Elements: Creates the batch elements for nodes/documents that need to be downloaded.
File
- ./
lingotek.batch.inc, line 507 - Central location for batch create functions, before control is handed off to individual batch command files.
Code
function lingotek_sync_download_chunk_target($cid, $lingotek_locale, $sync_success_status, &$context) {
if ($context) {
$context['message'] = t('Downloading "@locale" translation for configuration set #@cid', array(
'@locale' => $lingotek_locale,
'@cid' => $cid,
));
}
LingotekLog::trace('download chunk: @chunk_id (@language)', array(
'@chunk_id' => $cid,
'@language' => $lingotek_locale,
));
$trans_obj = LingotekConfigChunk::loadById($cid);
if ($trans_obj) {
$result = $trans_obj
->updateLocalContentByTarget($lingotek_locale);
}
if ($result) {
$context['results']['downloads'] = isset($context['results']['downloads']) && is_numeric($context['results']['downloads']) ? $context['results']['downloads'] + 1 : 1;
if (!isset($context['results']['downloaded_chunk_targets']) || !is_array($context['results']['downloaded_chunk_targets'])) {
$context['results']['downloaded_chunk_targets'] = array();
}
$context['results']['downloaded_chunk_targets'][] = array(
"cid" => $cid,
"locale" => $lingotek_locale,
);
}
else {
$context['results']['download_fails'] = isset($context['results']['download_fails']) && is_numeric($context['results']['download_fails']) ? $context['results']['download_fails'] + 1 : 1;
if (!isset($context['results']['download_fail_chunk_targets']) || !is_array($context['results']['download_fail_chunk_targets'])) {
$context['results']['download_fail_chunk_targets'] = array();
}
$context['results']['download_fail_chunk_targets'][] = array(
"cid" => $cid,
"locale" => $lingotek_locale,
);
}
}