Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Officialdocu
Uninstalling instructions and advice
1http://documentation.magnolia-cms.com/modules.html#Uninstalling

...

Uninstalling instructions and advice

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

Warning
titleWarning

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.

Info
titleAbout 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. If you are using Maven to manage your project, remove (or comment out) the dependency on that module from your POM, for example, in the case of SimpleMedia this would be the following POM snippet:
    Code Block
    xml
    titlepom.xml
    xml
    <dependency>
      <groupId>net.sourceforge.openutils</groupId>
      <artifactId>openutils-mgnlmedia</artifactId>
      <version>4.1</version>
    </dependency>
    
    

...

  1. If you are not using Maven, then make sure your app is shutdown and remove the module's JAR file from WEB-INF/lib

...

Become a Detective

  1. Download the source code for the module that you want to uninstall, make sure you grab the source for the version you currently have installed
  2. 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 node. For instance, it's common for modules to install items under /config/modules/adminInterface

...

  1. and

...

  1. /config/modules/standard-templating-kit

...

  1. Review

...

  1. the

...

  1. list

...

  1. of

...

  1. Bootstrap

...

  1. files

...

  1. located

...

  1. under

...

  1. the

...

  1. modules

...

  1. /resources/mgnl-bootstrap

...

  1. directory.

...

  1. The

...

  1. names

...

  1. are

...

  1. pretty

...

  1. self-explanatory,

...

  1. so

...

  1. take

...

  1. note

...

  1. of

...

  1. the

...

  1. files

...

  1. that

...

  1. don't

...

  1. start

...

  1. with

...

  1. config.modules.THE_MODULE_YOU_ARE_GOING_TO_UNINSTALL

...

  1. With

...

  1. this

...

  1. information,

...

  1. go

...

  1. to

...

  1. your

...

  1. own

...

  1. project's

...

  1. version

...

  1. handler,

...

  1. and

...

  1. open

...

  1. it

...

  1. up

...

  1. in

...

  1. an

...

  1. editor,

...

  1. what

...

  1. we're

...

  1. going

...

  1. to

...

  1. do

...

  1. in

...

  1. our

...

  1. version

...

  1. handler,

...

  1. is

...

  1. reverse

...

  1. the

...

  1. install

...

  1. and

...

  1. update

...

  1. tasks

...

  1. for

...

  1. the

...

  1. module

...

  1. we

...

  1. want

...

  1. to

...

  1. uninstall.

...

Example:

...

Uninstall

...

SimpleMedia

...

Module

...

:= }
Code Block
title
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.WEBSITE,
                                "/sample-simplemedia")
                        ),
                        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" +
                            "IMPORTANT: Please make sure to:\n" +
                            "1. Shutdown Magnolia\n" +
                            "2. Drop the tables prefixed with 'media_' or 'MEDIA_'.\n" +
                            "3. Delete the 'media' workspace directory from your Magnolia Repositories.\n" +
                            "4. Delete the 'templates/samples-media' directory from your webapps root directory.\n" +
                            "5. Startup Magnolia")
                    )
                )
            )
        );

{code}
--- TO BE CONTINUED ---

— TO BE CONTINUED —