Is there any configuration like, documents / media (used in web content) should be delete after deleting web content ?
Asked
Active
Viewed 75 times
1 Answers
2
No. Document and media files are independent type of assets. They may be used in zero, one or many web contents and by many other things (both inside and outside Liferay). Moreover other sites/apps may link to them directly. Therefore deleting them when a web content is removed is not a wise thing to do.
If you are 100% sure you ONLY use given document/media file in ONLY one web content, you can build a plugin that inspects the web content to be deleted and also deletes the media files used in it.

Milen Dyankov
- 2,972
- 14
- 25
-
I agree with every thing but "Therefore deleting them when a web content is removed is not a wise thing to do" as mentioned afterwards, this is app and business logic dependent. And just for complementing our college answer, one could start by building a plugin with what is known as model listener, just giving a tip where to start. however, one should be aware of legit business use cases, and the fact that web content may have multiple versions and it is an asset that may be sent to trash. so, this raises questions like, what if just one version is deleted? what if it is sent to trash... – Victor Jun 30 '18 at 21:05