function update_pending_sources in Lingotek Translation 7.7
2 calls to update_pending_sources()
- check_entity_progress_for_download in ./
lingotek.sync.inc - lingotek_get_and_update_target_progress in ./
lingotek.sync.inc - Updates the 'target_sync_status_[lang-code]' field for every target in the lingotek table with the overall progress returned by TMS
File
- ./
lingotek.sync.inc, line 432 - Sync and management
Code
function update_pending_sources($document_ids, $api) {
if (!is_array($document_ids)) {
$document_ids = array(
$document_ids,
);
}
$failed_doc_ids = [];
foreach ($document_ids as $doc_id) {
$ln = LingotekEntity::loadByLingotekDocumentId($doc_id);
$process_id = $ln
->getMetadataValue('process_id');
if (empty($process_id)) {
continue;
}
$result = $api
->sourceCompleted($process_id);
if (!is_bool($result)) {
$failed_doc_ids[] = $doc_id;
_lingotek_notification_handle_failed_upload($ln, $doc_id, $result);
continue;
}
if ($result) {
$ln
->setStatus(LingotekSync::STATUS_CURRENT);
$ln
->deleteMetadataValue("process_id");
$ln
->deleteMetadataValue("previous_doc_id");
$ln
->deleteMetadataValue("initial_upload");
}
}
return $failed_doc_ids;
}