Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/7.3' into 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dlubitz committed Oct 21, 2023
2 parents 25ef828 + 03c6b84 commit de4dd1f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,11 @@ protected function doDiscardNode(NodeInterface $node, array &$alreadyDiscardedNo
if ($possibleShadowNodeData instanceof NodeData) {
if ($possibleShadowNodeData->getMovedTo() !== null) {
$parentBasePath = $node->getPath();
$affectedChildNodeDataInSameWorkspace = $this->nodeDataRepository->findByParentAndNodeType($parentBasePath, null, $node->getWorkspace(), null, false, true);
foreach ($affectedChildNodeDataInSameWorkspace as $affectedChildNodeData) {
$affectedChildNodeDataInWorkspaceChain = $this->nodeDataRepository->findByParentAndNodeType($parentBasePath, null, $node->getWorkspace(), null, false, true);
foreach ($affectedChildNodeDataInWorkspaceChain as $affectedChildNodeData) {
if (!$affectedChildNodeData->matchesWorkspaceAndDimensions($node->getWorkspace(), $node->getDimensions())) {
continue;
}
/** @var NodeData $affectedChildNodeData */
$affectedChildNode = $this->nodeFactory->createFromNodeData($affectedChildNodeData, $node->getContext());
$this->doDiscardNode($affectedChildNode, $alreadyDiscardedNodeIdentifiers);
Expand Down
5 changes: 5 additions & 0 deletions Neos.Media/Classes/Domain/Model/Thumbnail.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,4 +224,9 @@ public function refresh()
{
$this->generatorStrategy->refresh($this);
}

public function getConfigurationHash(): string
{
return $this->configurationHash;
}
}
6 changes: 4 additions & 2 deletions Neos.Media/Classes/Domain/Service/ThumbnailGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ public function createThumbnails(AssetInterface $image)
{
if ($this->autoCreateThumbnailPresets) {
foreach ($this->thumbnailService->getPresets() as $preset => $presetConfiguration) {
$thumbnailConfiguration = $this->thumbnailService->getThumbnailConfigurationForPreset($preset, $this->asyncThumbnails);
$this->thumbnailService->getThumbnail($image, $thumbnailConfiguration);
if ($presetConfiguration) {
$thumbnailConfiguration = $this->thumbnailService->getThumbnailConfigurationForPreset($preset, $this->asyncThumbnails);
$this->thumbnailService->getThumbnail($image, $thumbnailConfiguration);
}
}
}
}
Expand Down
12 changes: 10 additions & 2 deletions Neos.Media/Classes/Domain/Service/ThumbnailService.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,16 @@ public function getThumbnail(AssetInterface $asset, ThumbnailConfiguration $conf
if (isset($this->thumbnailCache[$assetIdentifier][$configurationHash])) {
$thumbnail = $this->thumbnailCache[$assetIdentifier][$configurationHash];
} else {
$thumbnail = $this->thumbnailRepository->findOneByAssetAndThumbnailConfiguration($asset, $configuration);
$this->thumbnailCache[$assetIdentifier][$configurationHash] = $thumbnail;
$thumbnail = null;
// Load all thumbnails for the asset and cache them to prevent further db requests for the same asset
$thumbnailsForAsset = $this->thumbnailRepository->findByOriginalAsset($asset);
/** @var Thumbnail $thumbnailVariant */
foreach ($thumbnailsForAsset as $thumbnailVariant) {
$this->thumbnailCache[$assetIdentifier][$thumbnailVariant->getConfigurationHash()] = $thumbnailVariant;
if ($thumbnailVariant->getConfigurationHash() === $configurationHash) {
$thumbnail = $thumbnailVariant;
}
}
}
$async = $configuration->isAsync();
if ($thumbnail === null) {
Expand Down

0 comments on commit de4dd1f

Please sign in to comment.