OrchardCore
OrchardCore copied to clipboard
Functionality missing for uninstalling Modules
There is currently no way both programmatically and via the UI to uninstall a module. When you create a ContentType or add Content Parts via a module, disabling the module does not remove them from the UI.
Here is the scenario: I have a bunch of tenants that are hosted on Orchard Core. I have created a Module called Locations which adds an AddressPart (for containing addresses) and a ContentType called Locations (added by migrations.cs) and associated methods for querying and displaying Locations.
The tenant decides the no longer wants the Locations functionality as part of their subscription. Disabling it via the Module UI does not remove the AddressPart and the ContentType from the tenant. What I am after is a method that could be utilized to perform cleanup when a module is no longer needed.
After discussion with @scleaver and looking in the code I saw that we have a InstallState
for all modules but it's always set to "Up" and never really used anywhere in the code. I think it's there because previously in 01 we could uninstall modules because of dynamic compilation. It's not the case anymore, so we could use the already implemented feature "Uninstall" and adapt it so that we could have a Uninstall button displayed on each modules that implements an Uninstall method in their Migrations.cs file.