handle lastUpdateTime for Wopi implementation

* get the last updated time from the stored object's storage
* improve perf on loading content from stored object's storage: keep the
response in cache
This commit is contained in:
2022-06-20 21:22:02 +02:00
parent 1742dd4951
commit 10095343ec
5 changed files with 106 additions and 25 deletions

View File

@@ -147,8 +147,7 @@ final class ChillDocumentManager implements DocumentManagerInterface
*/
public function getLastModifiedDate(Document $document): DateTimeInterface
{
// TODO: Add column 'LastModifiedDate' in StoredObject entity
return $document->getCreationDate();
return $this->storedObjectManager->getLastModified($document);
}
public function getLock(Document $document): string

View File

@@ -13,6 +13,7 @@ namespace Chill\WopiBundle\Service\Wopi;
use ChampsLibres\WopiLib\Contract\Service\DocumentManagerInterface;
use ChampsLibres\WopiLib\Contract\Service\WopiInterface;
use DateTimeInterface;
use loophp\psr17\Psr17Interface;
use Psr\Cache\CacheItemPoolInterface;
use Psr\Http\Message\RequestInterface;
@@ -88,11 +89,14 @@ final class ChillWopi implements WopiInterface
'UserFriendlyName' => $userIdentifier,
'SupportsUpdate' => true,
'SupportsRename' => true,
'SupportsFolder' => false,
'DisablePrint' => false,
'AllowExternalMarketplace' => true,
'SupportedShareUrlTypes' => [
'ReadOnly',
],
'LastModifiedTime' => $this->documentManager->getLastModifiedDate($document)
->format(DateTimeInterface::ATOM),
'SHA256' => $this->documentManager->getSha256($document),
'UserInfo' => (string) $this->cache->getItem($userCacheKey)->get(),
]