diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2024-03-07 12:48:57 -0100 |
---|---|---|
committer | Maxence Lange <maxence@artificial-owl.com> | 2024-03-07 12:49:06 -0100 |
commit | 3fa5e598a8e74cc3c89b3c43a370bfcbef5115c5 (patch) | |
tree | 551f0be5eaf136d877b1de5ef0eabe885c3faf42 /lib/private/Blurhash | |
parent | e17424fa11e25828cce3756e9c076f08f9c45e01 (diff) | |
download | nextcloud-server-3fa5e598a8e74cc3c89b3c43a370bfcbef5115c5.tar.gz nextcloud-server-3fa5e598a8e74cc3c89b3c43a370bfcbef5115c5.zip |
feat(metadata): get deprecated status using file etag
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib/private/Blurhash')
-rw-r--r-- | lib/private/Blurhash/Listener/GenerateBlurhashMetadata.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/private/Blurhash/Listener/GenerateBlurhashMetadata.php b/lib/private/Blurhash/Listener/GenerateBlurhashMetadata.php index 7bfe36e9d41..b57dfa317e4 100644 --- a/lib/private/Blurhash/Listener/GenerateBlurhashMetadata.php +++ b/lib/private/Blurhash/Listener/GenerateBlurhashMetadata.php @@ -72,6 +72,12 @@ class GenerateBlurhashMetadata implements IEventListener { return; } + $currentEtag = $file->getEtag(); + $metadata = $event->getMetadata(); + if ($metadata->getEtag('blurhash') === $currentEtag) { + return; + } + // too heavy to run on the live thread, request a rerun as a background job if ($event instanceof MetadataLiveEvent) { $event->requestBackgroundJob(); @@ -95,8 +101,8 @@ class GenerateBlurhashMetadata implements IEventListener { return; } - $metadata = $event->getMetadata(); - $metadata->setString('blurhash', $this->generateBlurHash($image)); + $metadata->setString('blurhash', $this->generateBlurHash($image)) + ->setEtag('blurhash', $currentEtag); } /** |