mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-06 14:54:57 +00:00
Use "createdAt" from database to compute the last modified datetime in StoredObjectManager
The code has been updated to use 'createdAt' from StoredObjectVersion entity in StoredObjectManager. Specifically, if a 'createdAt' datetime is set, we return that datetime. This change also includes corresponding test cases to validate the functionality. The situation helps deal with files created before July 2024.
This commit is contained in:
@@ -37,6 +37,14 @@ final class StoredObjectManager implements StoredObjectManagerInterface
|
||||
{
|
||||
$version = $document instanceof StoredObject ? $document->getCurrentVersion() : $document;
|
||||
|
||||
if (null !== $createdAt = $version->getCreatedAt()) {
|
||||
// as a createdAt datetime is set, return the date and time from database
|
||||
return $createdAt;
|
||||
}
|
||||
|
||||
// if no createdAt version exists in the database, we fetch the date and time from the
|
||||
// file. This situation happens for files created before July 2024.
|
||||
|
||||
if ($this->hasCache($version)) {
|
||||
$response = $this->getResponseFromCache($version);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user