Issue
- The article at https://learn.liferay.com/dxp/latest/en/system-administration/file-storage/enabling-antivirus-scanning-for-uploaded-files.html describes mainly how to integrate/configure DXP with Clam AV.
- But what if I want to use some other antivirus scanner by extending the BaseFileAntivirusScanner class? What kind of module/project do I need to create, and how?
Environment
- DXP 7.3
Resolution
- You need to create a war hook (here's an article on war hooks: https://help.liferay.com/hc/en-us/articles/360018170611-WAR-Hook-Template)
- Don't put any antivirus-specific properties in your portal-ext.properties file (the war-hook module will contain the necessary properties)
- Please find attached such a war hook proof-of-concept, which you can test with these steps:
1. Start your 7.3 fp1 server and wait until it is fully up.
2. Copy the my-war-hook.war app to your deploy folder.
3. Log in to the server and try to upload a file to documents and media.
Result:
The console log should show you:
2021-06-10 18:09:05.396 INFO [fileinstall-directory-watcher][BundleStartStopLogger:46] STARTED my-war-hook_7.3.10.1 [1651]
* antivirus scanner works: This is the scan file method *
Additional Information