I’m working on a custom module and need to understand how module cleanup works during uninstallation.
Current situation:
The core uninstall process (module_manage_uninstallProcess.php) automatically removes:
-
Actions and permissions
-
Hooks
-
Settings (by scope)
-
Notification events
-
Module record
Database tables are only removed if the user selects them during uninstall.
Question:
Is there a way for a module to run custom cleanup code during uninstall without modifying core files? For example:
-
Deleting custom fields created by the module
-
Cleaning up file uploads
-
Removing related data from other tables
-
Other module-specific cleanup
What I’ve checked:
-
module_manage_uninstallProcess.php doesn’t include module-specific uninstall files
-
No hook/event system appears to be triggered during uninstall
-
The process seems to be a fixed sequence of operations
Goal:
I want to ensure my custom module cleans up all its resources on uninstall, but I don’t want to modify core files. Is there a supported extension point I’m missing, or would this require a core enhancement?
Thanks for any guidance.