Skip to content

Commit e42f934

Browse files
committed
ACP2E-2093: Issue when uploading image with the same name while deleting the old image
- Fixed the static test failure.
1 parent fba58d8 commit e42f934

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

app/code/Magento/Catalog/Model/Product/Gallery/UpdateHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ protected function processDeletedImages($product, array &$images)
116116
$this->deleteMediaAttributeValues($product, $imagesToDelete);
117117
$this->resourceModel->deleteGallery($recordsToDelete);
118118
$this->removeDeletedImages($filesToDelete);
119-
$this->removeDeletedImagesFromCache->removeDeletedImagesFromCache($product, $filesToDelete);
119+
$this->removeDeletedImagesFromCache->removeDeletedImagesFromCache($filesToDelete);
120120
}
121121

122122
/**

app/code/Magento/Catalog/Model/Product/Image/RemoveDeletedImagesFromCache.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,6 @@ class RemoveDeletedImagesFromCache
5050
*/
5151
private ParamsBuilder $imageParamsBuilder;
5252

53-
/**
54-
* @var Image
55-
*/
56-
private Image $imageHelper;
57-
5853
/**
5954
* @var ConvertImageMiscParamsToReadableFormat
6055
*/
@@ -66,7 +61,6 @@ class RemoveDeletedImagesFromCache
6661
* @param Config $mediaConfig
6762
* @param Filesystem $filesystem
6863
* @param ParamsBuilder $imageParamsBuilder
69-
* @param Image $imageHelper
7064
* @param ConvertImageMiscParamsToReadableFormat $convertImageMiscParamsToReadableFormat
7165
* @throws FileSystemException
7266
*/
@@ -76,29 +70,25 @@ public function __construct(
7670
Config $mediaConfig,
7771
Filesystem $filesystem,
7872
ParamsBuilder $imageParamsBuilder,
79-
Image $imageHelper,
8073
ConvertImageMiscParamsToReadableFormat $convertImageMiscParamsToReadableFormat
8174
) {
8275
$this->presentationConfig = $presentationConfig;
8376
$this->encryptor = $encryptor;
8477
$this->mediaConfig = $mediaConfig;
8578
$this->mediaDirectory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA);
8679
$this->imageParamsBuilder = $imageParamsBuilder;
87-
$this->imageHelper = $imageHelper;
8880
$this->convertImageMiscParamsToReadableFormat = $convertImageMiscParamsToReadableFormat;
8981
}
9082

9183
/**
9284
* Remove deleted images from cache.
9385
*
94-
* @param Product $product
9586
* @param array $files
9687
* @return null
9788
* @throws FileSystemException
9889
*/
99-
public function removeDeletedImagesFromCache(Product $product, array $files)
90+
public function removeDeletedImagesFromCache(array $files)
10091
{
101-
$this->imageHelper->init($product, 'product_page_image_small');
10292
$imageArguments = $this->presentationConfig
10393
->getViewConfig(['area' => \Magento\Framework\App\Area::AREA_FRONTEND])
10494
->getMediaAttributes(

0 commit comments

Comments
 (0)