Skip to content

Commit

Permalink
[BUGFIX] Always update index time when saving metadata
Browse files Browse the repository at this point in the history
Resolves: #101730
Releases: main, 12.4, 11.5
Change-Id: I9e400e1c582f84602b6aa8ef3cdd9a85f4e5b93e
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/81056
Tested-by: Stefan Bürk <stefan@buerk.tech>
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
Tested-by: core-ci <typo3@b13.com>
  • Loading branch information
georgringer authored and sbuerk committed Sep 18, 2023
1 parent 9029ecb commit 13ceba8
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions typo3/sysext/core/Classes/Resource/Index/Indexer.php
Expand Up @@ -75,11 +75,13 @@ public function createIndexEntry($identifier): File
}

$fileProperties = $this->gatherFileInformationArray($identifier);
$record = $this->getFileIndexRepository()->addRaw($fileProperties);
$fileIndexRepository = $this->getFileIndexRepository();

$record = $fileIndexRepository->addRaw($fileProperties);
$fileObject = $this->getResourceFactory()->getFileObject($record['uid'], $record);
$metaData = $this->extractRequiredMetaData($fileObject);
$fileIndexRepository->updateIndexingTime($fileObject->getUid());

$metaData = $this->extractRequiredMetaData($fileObject);
if ($this->storage->autoExtractMetadataEnabled()) {
$metaData = array_merge($metaData, $this->getExtractorService()->extractMetaData($fileObject));
}
Expand All @@ -96,13 +98,16 @@ public function updateIndexEntry(File $fileObject): File
$updatedInformation = $this->gatherFileInformationArray($fileObject->getIdentifier());
$fileObject->updateProperties($updatedInformation);

$this->getFileIndexRepository()->update($fileObject);
$metaData = $this->extractRequiredMetaData($fileObject);
$fileIndexRepository = $this->getFileIndexRepository();
$fileIndexRepository->update($fileObject);
$fileIndexRepository->updateIndexingTime($fileObject->getUid());

$metaData = $this->extractRequiredMetaData($fileObject);
if ($this->storage->autoExtractMetadataEnabled()) {
$metaData = array_merge($metaData, $this->getExtractorService()->extractMetaData($fileObject));
}
$fileObject->getMetaData()->add($metaData)->save();

return $fileObject;
}

Expand Down

0 comments on commit 13ceba8

Please sign in to comment.