@@ -88,32 +88,33 @@ public function __construct(
88
88
public function removeDeletedImagesFromCache (array $ files )
89
89
{
90
90
if (count ($ files ) > 0 ) {
91
- $ imageArguments = $ this ->presentationConfig
91
+ $ images = $ this ->presentationConfig
92
92
->getViewConfig (['area ' => \Magento \Framework \App \Area::AREA_FRONTEND ])
93
- ->getMediaAttributes (
93
+ ->getMediaEntities (
94
94
'Magento_Catalog ' ,
95
- Image::MEDIA_TYPE_CONFIG_NODE ,
96
- 'product_page_image_small '
95
+ Image::MEDIA_TYPE_CONFIG_NODE
97
96
);
98
97
99
- $ imageMiscParams = $ this ->imageParamsBuilder ->build ($ imageArguments );
98
+ foreach ($ images as $ imageData ) {
99
+ $ imageMiscParams = $ this ->imageParamsBuilder ->build ($ imageData );
100
100
101
- if (isset ($ imageMiscParams ['image_type ' ])) {
102
- unset($ imageMiscParams ['image_type ' ]);
103
- }
101
+ if (isset ($ imageMiscParams ['image_type ' ])) {
102
+ unset($ imageMiscParams ['image_type ' ]);
103
+ }
104
104
105
- $ cacheId = $ this ->encryptor ->hash (
106
- implode ('_ ' , $ this ->convertImageMiscParamsToReadableFormat
107
- ->convertImageMiscParamsToReadableFormat ($ imageMiscParams )),
108
- Encryptor::HASH_VERSION_MD5
109
- );
105
+ $ cacheId = $ this ->encryptor ->hash (
106
+ implode ('_ ' , $ this ->convertImageMiscParamsToReadableFormat
107
+ ->convertImageMiscParamsToReadableFormat ($ imageMiscParams )),
108
+ Encryptor::HASH_VERSION_MD5
109
+ );
110
110
111
- $ catalogPath = $ this ->mediaConfig ->getBaseMediaPath ();
111
+ $ catalogPath = $ this ->mediaConfig ->getBaseMediaPath ();
112
112
113
- foreach ($ files as $ filePath ) {
114
- $ this ->mediaDirectory ->delete (
115
- $ catalogPath . '/cache/ ' . $ cacheId . '/ ' . $ filePath
116
- );
113
+ foreach ($ files as $ filePath ) {
114
+ $ this ->mediaDirectory ->delete (
115
+ $ catalogPath . '/cache/ ' . $ cacheId . '/ ' . $ filePath
116
+ );
117
+ }
117
118
}
118
119
}
119
120
}
0 commit comments