/** * Updates the content of an existing Lingotek document with the current object contents. * * @param stdClass $translatable_object * A Drupal node object or another object, such as a config chunk, etc. * * @return bool * TRUE on success, FALSE on failure. */ public function updateContentDocument($translatable_object) { $parameters['documentId'] = $translatable_object->getMetadataValue('document_id'); $parameters['documentName'] = $translatable_object->getDocumentName(); $parameters['documentDesc'] = $translatable_object->getDescription(); $parameters['content'] = $translatable_object->documentLingotekXML(); $parameters['url'] = $translatable_object->getUrl(); $parameters['format'] = $this->xmlFormat(); $this->addAdvancedParameters($parameters, $translatable_object); $result = $this->request('updateContentDocumentAsync', $parameters); if ($result) { if (get_class($translatable_object) == 'LingotekConfigChunk') { $translatable_object->setStatus(LingotekSync::STATUS_CURRENT); $translatable_object->setTargetsStatus(LingotekSync::STATUS_PENDING); // WTD: there is a race condition here where a user could modify a locales- // source entry between the time the dirty segments are pulled and the time // they are set to current at this point. This same race condition exists // for nodes as well; however, the odds may be lower due to number of entries. LingotekConfigChunk::setSegmentStatusToCurrentById($translatable_object->getId()); } } return $result ? TRUE : FALSE; }