Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Sometimes you may find it necessary to uninstall a module you had previously installed.

Warning

The following is a working draft of how to go about uninstalling a module. It is not yet finished, nor has it yet been vetted.

About the example

Note: The example used here is the SimpleMedia module. The choice to use it as the example for how to uninstall should NOT be interpreted as a slight of any kind. Indeed, IMHO, the module is extremely well done. I only use it here as an example because the uninstall process is a bit more complicated than simply removing the jar from WEB-INF/lib and deleting the modules config directory.

Getting Started

  1. Open the VersionHandler for the module you want to uninstall. Review the install and update tasks included in it, paying special attention to tasks that install or modify configuration outside of it's own module directory. For instance, it's common for modules to install items under /config/modules/adminInterface and /config/modules/standard-templating-kit
  2. Review the list of Bootstrap files located under the modules /resources/mgnl-bootstrap directory. The names are pretty self-explanatory, so take note of the files that don't start with config.modules.THE_MODULE_YOU_ARE_GOING_TO_UNINSTALL
  3. With this information, go to your own projects version handler, and open it up in an editor, what we're going to do in our version handler, is reverse the install and update tasks for the module we want to uninstall.

Example: Uninstall SimpleMedia Module

Uninstall tasks within MyProjectModuleVersionHandler

        register(DeltaBuilder.update("1.5.0", "Update various configurations for this module and uninstall SimpleMedia module")
            .addTask(
                new IsModuleInstalledOrRegistered("Uninstall OpenUtils SimpleMedia Module",
                    "Uninstalls OpenUtils SimpleMedia Module if it is installed",
                    "media",
                    new ArrayDelegateTask("Uninstall OpenUtils SimpleMedia module", 
                        "Removes all configuration related to the OpenUtils SimpleMedia module",
                        new CheckAndModifyPropertyValueTask("Update Magnolia Standard Templating Kit template-renderers", 
                            "Update Magnolia Standard Templating Kit template-renderers back to the default since we are removing the OpenUtils SimpleMedia module", 
                            ContentRepository.CONFIG, 
                            "/modules/standard-templating-kit/template-renderers/stk", 
                            "renderer", 
                            "net.sourceforge.openutils.mgnlmedia.freemarker.SktSimpleMediaTemplateRenderer", 
                            "info.magnolia.module.templatingkit.renderers.STKTemplateRenderer"),
                        new CheckAndModifyPropertyValueTask("Update Magnolia Standard Templating Kit paragraph-renderers", 
                            "Update Magnolia Standard Templating Kit paragraph-renderers back to the default since we are removing the OpenUtils SimpleMedia module", 
                            ContentRepository.CONFIG, 
                            "/modules/standard-templating-kit/paragraph-renderers/stk", 
                            "class", 
                            "net.sourceforge.openutils.mgnlmedia.freemarker.SktSimpleMediaParagraphRenderer", 
                            "info.magnolia.module.templatingkit.renderers.STKParagraphRenderer"),
                        new NodeExistsDelegateTask("Remove 'activateMedia' command from adminInterface configuration", 
                            "Removes 'activateMedia' command if it exists", 
                            ContentRepository.CONFIG,  
                            "/modules/adminInterface/commands/default/activateMedia",
                            new RemoveNodeTask("Remove 'activateMedia' command", 
                                "", 
                                ContentRepository.CONFIG, 
                                "/modules/adminInterface/commands/default/activateMedia")
                        ),
                        new NodeExistsDelegateTask("Remove 'media' menu from adminInterface configuration", 
                            "Removes 'media' menu if it exists", 
                            ContentRepository.CONFIG,  
                            "/modules/adminInterface/config/menu/media",
                            new RemoveNodeTask("Remove 'media' menu", 
                                "", 
                                ContentRepository.CONFIG, 
                                "/modules/adminInterface/config/menu/media")
                        ),
                        new NodeExistsDelegateTask("Remove 'mediaJCR' menu from adminInterface configuration", 
                            "Removes 'mediaJCR' menu if it exists", 
                            ContentRepository.CONFIG,  
                            "/modules/adminInterface/config/menu/tools/mediaJCR",
                            new RemoveNodeTask("Remove 'mediaJCR' menu", 
                                "", 
                                ContentRepository.CONFIG, 
                                "/modules/adminInterface/config/menu/tools/mediaJCR")
                        ),
                        new NodeExistsDelegateTask("Remove 'media-selector' from fckEditor configuration", 
                            "Removes 'media-selector' menu if it exists", 
                            ContentRepository.CONFIG,  
                            "/modules/fckEditor/config/browsableRepositories/media-selector",
                            new RemoveNodeTask("Remove 'media-selector' menu", 
                                "", 
                                ContentRepository.CONFIG, 
                                "/modules/fckEditor/config/browsableRepositories/media-selector")
                        ),
                        new NodeExistsDelegateTask("Remove 'media' handler from standard-templating-kit damSupport configuration", 
                            "Removes 'media' handler from standard-templating-kit damSupport configuration if it exists", 
                            ContentRepository.CONFIG,  
                            "/modules/standard-templating-kit/config/site/damSupport/handlers/media",
                            new RemoveNodeTask("Remove 'media' handler", 
                                "", 
                                ContentRepository.CONFIG, 
                                "/modules/standard-templating-kit/config/site/damSupport/handlers/media")
                        ),
                        new NodeExistsDelegateTask("Remove 'media' module configuration", 
                            "Removes all 'media' module configuration if it exists", 
                            ContentRepository.CONFIG,  
                            "/modules/media",
                            new RemoveNodeTask("Remove all 'media' module configuration", 
                                "", 
                                ContentRepository.CONFIG, 
                                "/modules/media")
                        ),
                        new NodeExistsDelegateTask("Remove 'media' mappings from server URI2RespositoryMapping configuration", 
                            "Removes 'media' mappings from server URI2RespositoryMapping if it exists", 
                            ContentRepository.CONFIG,  
                            "/server/URI2RepositoryMapping/mappings/media",
                            new RemoveNodeTask("Remove 'media' mappings from server URI2RespositoryMapping", 
                                "", 
                                ContentRepository.CONFIG, 
                                "/server/URI2RepositoryMapping/mappings/media")
                        ),
                        new NodeExistsDelegateTask("Remove 'sample-simplemedia' website", 
                            "Removes 'sample-simplemedia' website if it exists", 
                            ContentRepository.WEBSITE,  
                            "/sample-simplemedia",
                            new RemoveNodeTask("Remove 'sample-simplemedia' website", 
                                "", 
                                ContentRepository.CONFIG, 
                                "/sample-simplemedia")
                        ),
                        new NodeExistsDelegateTask("Remove 'samples' content from media repository", 
                            "Removes 'samples' content from media repository if it exists", 
                            "media",  
                            "/samples",
                            new RemoveNodeTask("Remove 'samples' content from media repository", 
                                "", 
                                "media", 
                                "/samples")
                        ),
                        new WarnTask("Note: OpenUtils SimpleMedia module configuration and sample content has been removed", 
                            "All configuration and sample content related to OpenUtils SimpleMedia module has been removed.\n" +
                            "Please make sure to:\n" +
                            "1. delete the 'media' workspace from your Magnolia Repositories.\n" +
                            "2. delete the 'templates/samples-media' directory from your webapps root directory.")
                    )
                )
            )
        );

— TO BE CONTINUED —

  • No labels