public function Lingotek::getUploadedTimestamp in Lingotek Translation 8
Same name and namespace in other branches
- 8.2 src/Lingotek.php \Drupal\lingotek\Lingotek::getUploadedTimestamp()
- 4.0.x src/Lingotek.php \Drupal\lingotek\Lingotek::getUploadedTimestamp()
- 3.0.x src/Lingotek.php \Drupal\lingotek\Lingotek::getUploadedTimestamp()
- 3.1.x src/Lingotek.php \Drupal\lingotek\Lingotek::getUploadedTimestamp()
- 3.2.x src/Lingotek.php \Drupal\lingotek\Lingotek::getUploadedTimestamp()
- 3.3.x src/Lingotek.php \Drupal\lingotek\Lingotek::getUploadedTimestamp()
- 3.4.x src/Lingotek.php \Drupal\lingotek\Lingotek::getUploadedTimestamp()
- 3.5.x src/Lingotek.php \Drupal\lingotek\Lingotek::getUploadedTimestamp()
- 3.6.x src/Lingotek.php \Drupal\lingotek\Lingotek::getUploadedTimestamp()
- 3.7.x src/Lingotek.php \Drupal\lingotek\Lingotek::getUploadedTimestamp()
- 3.8.x src/Lingotek.php \Drupal\lingotek\Lingotek::getUploadedTimestamp()
Gets the last edited timestamp from Lingotek service.
Parameters
string $doc_id: The document id in Lingotek.
Return value
int The timestamp.
Overrides LingotekInterface::getUploadedTimestamp
File
- src/
Lingotek.php, line 297 - Contains \Drupal\lingotek\Lingotek.
Class
Namespace
Drupal\lingotekCode
public function getUploadedTimestamp($doc_id) {
// For now, a passthrough to the API object so the controllers do not
// need to include that class.
$modified_date = FALSE;
try {
$response = $this->api
->getDocumentInfo($doc_id);
if ($response
->getStatusCode() == Response::HTTP_OK) {
$response_json = json_decode($response
->getBody(), TRUE);
// We have millisecond precision in Lingotek.
$modified_date = intval(floor($response_json['properties']['last_uploaded_date'] / 1000));
}
} catch (LingotekApiException $exception) {
return FALSE;
}
return $modified_date;
}