Hi Goran,
It is challenging to come up with a comprehensive uninstall system. Due to the fact that custom features may have their own tables with moduleid/moduleguid and there is no way that mojoPortal can know about feature specific tables, part of the deletion strategy must be implemented by the feature developer.
The steps I recommend are
-
Delete each instance of your feature from the module settings page for an instance if you delete it it will delete the instance from all pages containing the instance and then it will delete the module instance. But to delete data from feature tables you must implement a ContentDeleteHandler. I don't currently have documentation about this other than the source code for included features which all support it if they have their own tables. The handlers are registered from config files under /Setup/ProviderConfig/contentdeletehandlers. you have to implement your own ContentDeleteHandler inheriting from mojoPortal.Business.WebHelpers.ContentDeleteHandlerProvider which simply defines a void where the moduleid and moduleguid will be passed so your code can do what it needs to delete related content. You must do this in each site where the feature is used.
-
Now that all instances are deleted from the UI, you can also delete feature settings then delete the feature itself from Advanced Tools > Feature Installation
-
In addition to contentdeletehandlers, included features also implement SitePreDeleteHandlers that delete feature content based on siteid so the content can be deleted before the site is deleted.
Now I do consider it a bug that we are not deleting the it from mp_SiteModuleDefinitions. I will fix that. I thought we already had that in place. In a multi site installation you can remove it from that table for child sites because there is a UI element in Site Settings for installing or removing features from a child site.
Going forward I think we could improve the process by implementing a provider model to plugin featuredeletehandlers. This would allow deleting a feature without manually deleting instances but it would depend on the feature developer to remove all instance content in all sites in this event.
Deleting features is even more challenging the more complex they are. Consider the BlogContentDeleteHandler, if you delete an instance of a blog then it must delete the blog content but also the friendly urls and it must clear content that was previously indexed into the search index.
Best,
Joe