From c6834d8c0e7b4eb0a2cd3adc606ebb3f30562726 Mon Sep 17 00:00:00 2001 From: Oliver Hader Date: Thu, 11 Apr 2013 20:58:58 +0200 Subject: [PATCH] [BUGFIX] ProcessedFile/Thumbnail is always regenerated A ProcessedFile/Thumbnail is always regenerated even if there are not modifications to the original file. The reasons for this spread all over the ProcessedFile handling and boils down to a new ProcessedFile is being persisted in the file-system by using a regular ResourceStorage::addFile() call that results in a plain File object. The indexer then tries to load this file and will create a new UID for the thumbnail in sys_file. This uid value is then used to update(!) the sys_file_processedfile entry - which fails since the uid was taken from sys_file. The bug was introduced in I53e4eb42def291ba88ce18209a348b1e2f592185 were the processedFile is updated with information of a File object and the wrong uid is transfered as property. Fixes: #47140 Releases: 6.1, 6.0 Change-Id: I4252b237d6022485c51ad32a7f956f5afcda8c08 Reviewed-on: https://review.typo3.org/19810 Reviewed-by: Oliver Hader Tested-by: Oliver Hader --- typo3/sysext/core/Classes/Resource/ProcessedFile.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/typo3/sysext/core/Classes/Resource/ProcessedFile.php b/typo3/sysext/core/Classes/Resource/ProcessedFile.php index 6779efc56e7e..ec091a128a13 100644 --- a/typo3/sysext/core/Classes/Resource/ProcessedFile.php +++ b/typo3/sysext/core/Classes/Resource/ProcessedFile.php @@ -196,7 +196,12 @@ class ProcessedFile extends AbstractFile { // Update some related properties $this->identifier = $addedFile->getIdentifier(); $this->originalFileSha1 = $this->originalFile->getSha1(); - $this->updateProperties($addedFile->getProperties()); + // The added file is a FileInterface object with own uid + // We have to unset uid otherwise the processed file couldn't be stored in database + // Other non-used fields were removed before database progress + $updateProperties = $addedFile->getProperties(); + unset($updateProperties['uid']); + $this->updateProperties($updateProperties); $this->deleted = FALSE; $this->updated = TRUE; } -- 2.20.1