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 (7)

Collapse
 
kenrbnsn profile image
Ken Robinson

Following the procedure, I got a WSOD after doing this step:
YOUR-SITE-URL/admin/modules/uninst...
I forged ahead anyway and everything else seemed to work OK. Thanks

Collapse
 
davo20019 profile image
David Loor

Glad that it worked.

Collapse
 
kenrbnsn profile image
Ken Robinson

@davo20019 I'm finally trying to follow your example, but your repo is missing. :( Is it somewhere else?

Collapse
 
davo20019 profile image
David Loor

@kenrbnsn I jus updated the post, and the link is this one: github.com/davo20019/multiversion-...

Collapse
 
kenrbnsn profile image
Ken Robinson • Edited

@davo20019 I followed the directions and it seemed to get rid of multiversion and all of the associated modules. I've updated my site to 9.5.7, but when I do a
"$ drush updb -y"

I get this error:

>  [notice] Update started: system_post_update_entity_revision_metadata_bc_cleanup
>  [error]  Drupal\multiversion\Entity\Storage\Sql\MediaStorage does not implement Drupal\Core\Entity\ContentEntityStorageInterface
>  [error]  Update failed: system_post_update_entity_revision_metadata_bc_cleanup
 [error]  Update aborted by: system_post_update_entity_revision_metadata_bc_cleanup
Enter fullscreen mode Exit fullscreen mode

What to I have to do to get rid of that error?

Collapse
 
tonygutierrez profile image
tony-gutierrez • Edited

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

Collapse
 
davo20019 profile image
David Loor

@tonygutierrez you many not longer need this, but I just updated the link. github.com/davo20019/multiversion-...