From 905bad7eb5b0523719c83f94ab0e07d307da42be Mon Sep 17 00:00:00 2001 From: Karsten Dambekalns Date: Wed, 16 Feb 2022 23:19:06 +0100 Subject: [PATCH] Remove replaced resource if possible --- Classes/Service/AssetUpdateService.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Classes/Service/AssetUpdateService.php b/Classes/Service/AssetUpdateService.php index dc50387..ba03cd5 100644 --- a/Classes/Service/AssetUpdateService.php +++ b/Classes/Service/AssetUpdateService.php @@ -148,8 +148,8 @@ private function replaceAsset(string $identifier): void $this->logger->debug(sprintf('Did not replace resource on %s from %s, the local asset is an ImageVariant', $localAssetIdentifier, $identifier), LogEnvironment::fromMethodName(__METHOD__)); return; } - // TODO do we need to delete the "old" resource? then we need to grab it here… - // $previousResource = $localAsset->getResource(); + // we need to delete the "old" resource, so we grab it here… + $previousResource = $localAsset->getResource(); try { $this->flushProxyForAsset($identifier); @@ -162,8 +162,8 @@ private function replaceAsset(string $identifier): void $assetResource->setFilename($proxy->getFilename()); $this->assetService->replaceAssetResource($localAsset, $assetResource); - // TODO … to delete it here! - // $this->resourceManager->deleteResource($previousResource); + // … to delete it here! + $this->resourceManager->deleteResource($previousResource); $this->logger->debug(sprintf('Replaced resource on %s from %s', $localAssetIdentifier, $identifier), LogEnvironment::fromMethodName(__METHOD__)); }