This project is not covered by Drupal’s security advisory policy.
An "exterminator" for pesky Multiversion problems. Provides workarounds for failed uninstall logic in the Multiversion module.
Do not use this module in production environments. Backup your database before using this module. We are not responsible for data loss.
This module leverages Multiversion's API to remove Multiversion support from as many entity types as Multiversion can properly handle. Then, this module provides a more hands-on/surgical approach to remove Multiversion from entity types that neither Multiversion nor Core are willing to handle (e.g. "comment" entity types).
This module is intended to be invoked from a schema update hook (i.e. hook_update_n()). Since several operations can take minutes or hours to complete, the update should be invoked through Drush, not via a the web-based interactive update script (update.php). Otherwise, you may experience timeouts.
Usage Example
In this example, Multiversion Remover is invoked to completely remove Multiversion from the current site, handling the "comment" entity type specially in the process since Multiversion itself fails to handle removal properly (normally, it would result in the error message "schema change requires a data migration"):
/**
* Uninstalls Multiversion.
*/
function my_module_update_8101(array &$sandbox) {
/** @var \Drupal\Core\Extension\ModuleInstallerInterface $module_installer */
$module_installer = \Drupal::service('module_installer');
$module_installer->install(['multiversion_remover']);
$entity_type_ids_requiring_manual_removal = [
'node',
'comment',
];
// Exception should bubble-up to rollback update.
// @codingStandardsIgnoreLine
/** @noinspection PhpUnhandledExceptionInspection */
multiversion_remover_execute($entity_type_ids_requiring_manual_removal);
}
/**
* Uninstalls the Multiversion Remover module (no longer needed).
*/
function my_module_update_8102() {
/** @var \Drupal\Core\Extension\ModuleInstallerInterface $module_installer */
$module_installer = \Drupal::service('module_installer');
$module_installer->uninstall(['multiversion_remover']);
}
Output
A snapshot of the starting and ending entity counts and a log of the steps that the module is taking during removal are written to standard out when the update hook is invoked via Drush. This output is also captured to the site DB log (if enabled), though longer operations may exceed the maximum number of log entries that the DB log keeps so older log lines may expire.
Here's an example of the output:
Entity counts before removal
============================
Custom block: 0
Comment: 5
Crop: 0
File: 419
Custom menu link: 6
Content: 20
Shortcut link: 3
Taxonomy term: 300
Paragraph: 18
Attempting to disable Multiversion for entity type block_content
Attempting to disable Multiversion for entity type crop
Attempting to disable Multiversion for entity type file
Attempting to disable Multiversion for entity type menu_link_content
Attempting to disable Multiversion for entity type shortcut
Attempting to disable Multiversion for entity type taxonomy_term
Attempting to disable Multiversion for entity type paragraph
Manually removing Multiversion support for entity type node
Manually purging soft-deleted entities of entity type node
- Deleting the following entities of type node: [8, 9, 10, 11]
Scanning for revision tables to drop for node
- No revision tables to drop (entity type is revisionable by core).
Manually purging Multiversion fields from entity type node
- Dropping node_field_data.workspace
- Dropping node_field_data._deleted
- Dropping node_field_data._rev
- Dropping node_field_revision._deleted
- Dropping node_field_revision._rev
Manually removing revision support from entity type node
Manually removing Multiversion support for entity type comment
Manually purging soft-deleted entities of entity type comment
- Deleting the following entities of type comment: []
Scanning for revision tables to drop for comment
- Removing revision storage table comment_revision from field storage schema for langcode
- Removing revision storage table comment_field_revision from field storage schema for langcode
- Removing revision storage table comment_field_revision from field storage schema for status
- Removing revision storage table comment_field_revision from field storage schema for uid
- Removing revision storage table comment_field_revision from field storage schema for pid
- Removing revision storage table comment_field_revision from field storage schema for entity_id
- Removing revision storage table comment_field_revision from field storage schema for subject
- Removing revision storage table comment_field_revision from field storage schema for name
- Removing revision storage table comment_field_revision from field storage schema for mail
- Removing revision storage table comment_field_revision from field storage schema for homepage
- Removing revision storage table comment_field_revision from field storage schema for hostname
- Removing revision storage table comment_field_revision from field storage schema for created
- Removing revision storage table comment_field_revision from field storage schema for changed
- Removing revision storage table comment_field_revision from field storage schema for thread
- Removing revision storage table comment_field_revision from field storage schema for entity_type
- Removing revision storage table comment_field_revision from field storage schema for field_name
- Removing revision storage table comment_field_revision from field storage schema for default_langcode
- Removing revision storage table comment_revision from field storage schema for revision_default
- Removing revision storage table comment_field_revision from field storage schema for revision_translation_affected
- Removing revision storage table comment_field_revision from field storage schema for _deleted
- Removing revision storage table comment_field_revision from field storage schema for _rev
- Removing revision storage table comment_revision__comment_body from field storage schema for comment_body
- Removing revision storage table comment_revision__field_field_note_audience from field storage schema for field_field_note_audience
- Removing revision storage table comment_revision__field_note_type from field storage schema for field_note_type
- Dropping revision storage table comment_revision
- Dropping revision storage table comment_field_revision
- Dropping revision storage table comment_revision__comment_body
- Dropping revision storage table comment_revision__field_field_note_audience
- Dropping revision storage table comment_revision__field_note_type
Manually purging Multiversion fields from entity type comment
- Dropping comment.revision_id
- Dropping comment_field_data.workspace
- Dropping comment_field_data._deleted
- Dropping comment_field_data._rev
- Dropping comment_field_data.revision_id
- Dropping comment_field_data.revision_translation_affected
Manually removing revision support from entity type comment
- Removing key revision_id from comment
- Removing key revision_translation_affected from comment
Attempting to disable Multiversion for entity type comment
Deleting workspace entity type workspace
Skipping workspace entity type workspace_pointer (not installed)
Skipping uninstall of module workspace (not installed)
Uninstalling module multiversion
Skipping uninstall of module replication (not installed)
Skipping uninstall of module relaxed (not installed)
Purging multiversion key-value collection multiversion.entity_index.id.1
Purging multiversion key-value collection multiversion.entity_index.rev.1
Purging multiversion key-value collection multiversion.entity_index.rev.tree.1.00198f9a-4b73-47af-8e91-335499dae1f4
Purging multiversion key-value collection multiversion.entity_index.rev.tree.1.00706fe1-8d82-46cc-9091-43fc868fb90d
Purging multiversion key-value collection multiversion.entity_index.rev.tree.1.00879459-292f-4052-bf8e-28d4e866f228
Purging multiversion key-value collection multiversion.entity_index.rev.tree.1.00a3f48a-be21-4a00-addc-f08688bda6f2
Purging multiversion key-value collection multiversion.entity_index.uuid.1
Purging multiversion key-value list collections: multiversion.entity_index.sequence.1
Purging stale storage schema field definitions from entity type block_content
- Purging workspace (block_content.field_schema_data.workspace)
- Purging _deleted (block_content.field_schema_data._deleted)
- Purging _rev (block_content.field_schema_data._rev)
Purging stale storage schema field definitions from entity type comment
- Purging workspace (comment.field_schema_data.workspace)
- Purging _deleted (comment.field_schema_data._deleted)
- Purging _rev (comment.field_schema_data._rev)
- Purging revision_id (comment.field_schema_data.revision_id)
- Purging revision_translation_affected (comment.field_schema_data.revision_translation_affected)
Purging stale storage schema field definitions from entity type crop
- Purging workspace (crop.field_schema_data.workspace)
- Purging _deleted (crop.field_schema_data._deleted)
- Purging _rev (crop.field_schema_data._rev)
Purging stale storage schema field definitions from entity type file
- Purging workspace (file.field_schema_data.workspace)
- Purging _deleted (file.field_schema_data._deleted)
- Purging _rev (file.field_schema_data._rev)
- Purging revision_id (file.field_schema_data.revision_id)
Purging stale storage schema field definitions from entity type menu_link_content
- Purging workspace (menu_link_content.field_schema_data.workspace)
- Purging _deleted (menu_link_content.field_schema_data._deleted)
- Purging _rev (menu_link_content.field_schema_data._rev)
- Purging menu_name (menu_link_content.field_schema_data.menu_name)
- Purging rediscover (menu_link_content.field_schema_data.rediscover)
- Purging weight (menu_link_content.field_schema_data.weight)
- Purging expanded (menu_link_content.field_schema_data.expanded)
- Purging parent (menu_link_content.field_schema_data.parent)
Purging stale storage schema field definitions from entity type node
- Purging workspace (node.field_schema_data.workspace)
- Purging _deleted (node.field_schema_data._deleted)
- Purging _rev (node.field_schema_data._rev)
Purging stale storage schema field definitions from entity type shortcut
- Purging workspace (shortcut.field_schema_data.workspace)
- Purging _deleted (shortcut.field_schema_data._deleted)
- Purging _rev (shortcut.field_schema_data._rev)
- Purging revision_id (shortcut.field_schema_data.revision_id)
- Purging revision_translation_affected (shortcut.field_schema_data.revision_translation_affected)
Purging stale storage schema field definitions from entity type taxonomy_term
- Purging workspace (taxonomy_term.field_schema_data.workspace)
- Purging _deleted (taxonomy_term.field_schema_data._deleted)
- Purging _rev (taxonomy_term.field_schema_data._rev)
- Purging weight (taxonomy_term.field_schema_data.weight)
Purging stale storage schema field definitions from entity type paragraph
- Purging workspace (paragraph.field_schema_data.workspace)
- Purging _deleted (paragraph.field_schema_data._deleted)
- Purging _rev (paragraph.field_schema_data._rev)
Entity counts after removal
===========================
Custom block: 0
Comment: 5
Crop: 0
File: 425
Custom menu link: 6
Content: 20
Shortcut link: 3
Taxonomy term: 300
Paragraph: 18
Project information
Unsupported
Not supported (i.e. abandoned), and no longer being developed. Learn more about dealing with unsupported (abandoned) projectsNo further development
No longer developed by its maintainers.- Project categories: Content editing experience
- Ecosystem: Multiversion
- Created by guypaddock on , updated
This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.
