DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

David Loor
David Loor

Posted on • Updated on • Originally published at davidloor.com

How to uninstall the contrib module multiversion on Drupal 8.7 or later

If you are planning an upgrade from Drupal 8 to Drupal 9, I strongly recommend that you uninstall the contrib module multiversion before you update the core to the latest 9.x version.

Some of the contrib modules that require the multiversion module are: Deploy, Workspace, Replication. These modules will be automatically uninstalled as part of this process too.

1. Install the Multiversion Remover.

The module Multiversion Remover plays an important role on this process, so we need to install it:

composer require 'drupal/multiversion_remover:1.0.x-dev@dev'
drush en multiversion_remover -y
Enter fullscreen mode Exit fullscreen mode

2. Delete replication, replication_log and workspace entities.
Go to the following URLs and delete all the entities:
https://YOUR-SITE_URL/admin/modules/uninstall/entity/replication
https://YOUR-SITE-URL/admin/modules/uninstall/entity/replication_log
https://YOUR-SITE-URL/admin/modules/uninstall/entity/workspace

3.-Implement a hook update.
Copy the code from this repo and paste it in a hook update in one of your custom modules.

Clear caches from the backend https://YOUR-SITE-URL/admin/config/development/performance or using the terminal drush cr

4.- Run the Drupal updates
We need to execute the hook update that we implemented in the previous step, so we have to run the drupal updates from the browser https://YOUR-SITE-URL/update.php or using the terminal drush updb -y

Important: While the updates are running, we need to check if the entities that we deleted in a previous step are not recreated, otherwise, we will have to re-delete them.

Remember, it has to be done before the updates process ends.
URLs to check if the entities were not re-created while running the updates:
https://YOUR-SITE_URL/admin/modules/uninstall/entity/replication
https://YOUR-SITE-URL/admin/modules/uninstall/entity/replication_log
https://YOUR-SITE-URL/admin/modules/uninstall/entity/workspace

Most likely, you will get an error, that is ok.

5.- Execute multiversion remover functions.
You need to execute the following commands, to complete the removal process:

drush php-eval "multiversion_remover_uninstall_multiversion_suite()"
drush php-eval "_multiversion_remover_purge_multiversion_kvp()"
Enter fullscreen mode Exit fullscreen mode

6.- Uninstall the Multiversion Remover module.
At this point, the Multiversion Remover module did its job and we can remove it from the project.

drush pmu multiversion_remover -y
composer remove drupal/multiversion_remover
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
tonygutierrez profile image
tony-gutierrez • Edited on

@davo20019 Your gist link is broken for the update hook repo code?

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.