-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1245: fix image still exists after delete #1279
1245: fix image still exists after delete #1279
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the pull request, @coderimus ! please see my comment
public function execute(AssetInterface $asset): void | ||
{ | ||
$mediaDirectory = $this->filesystem->getDirectoryRead(DirectoryList::MEDIA); | ||
$absolutePath = $mediaDirectory->getAbsolutePath($asset->getPath()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check if the path is blacklisted before deleting an image (IsPathBlacklistedInterface
).
Also, please add the information that the asset is removed from the database via the plugin
@coderimus does this pull request depends on magento/magento2#27994 ? Or what is the dependency? |
@sivaschenko thank you for your review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@engcom-Bravo thank you for the QA. May I asked you to make one more test: as I can see you added an image to the root directory and I faced with the same behaviour as you but could reproduce it only several times and than it was gone. Thought that it was my local problem. Test scenario: add an image to any kind of folder except root media directory and then test delete it. Thank you |
@sivaschenko I would like to request your expertise :) Yesterday when I made this PR magento/magento2#27994 I faced with an issue which I considered as my local. But it appears to be the real one according to the current PR QA result. Steps to reproduce: add an image to the root media gallery folder. It's path should be I found that the reason for this is that the I tried to fix it like on my screenshot and it seems to be work but I am not totally sure that this is the correct way. Please, check this. |
@coderimus I don't think the path should be changed in the delete service, the correct path should be passed by client |
✔️ QA Passed images deleted from physical storage, folder deleted from physical storage and from the media_gallery_asset |
Description (*)
To fix the reported issue I provide this PR: use
Magento\Cms\Model\Wysiwyg\Images\Storage::deleteFile
for image delete process. This method removes the image physically and has a plugin which will remove data from a data storage -\Magento\MediaGallery\Plugin\Wysiwyg\Images\Storage::afterDeleteFile
I also choose this method because ofMagento_MediaGalleryUi
has a dependency and use theMagento_CMS module
.Fixed Issues (if relevant)
#1245
Depends on: magento/magento2#27994