Problem/Motivation

I have a module in contrib that provides/manages a certain type of plugin. Plugins of this type correspond to a column on a database table whose field schema is defined on the plugin. When a module providing this type of plugin is installed or uninstalled, this column needs to be added or dropped from the table.

Currently, the field "installation" can easily be done with db_add_field() in a hook_modules_installed() implementation. However, I'm unable to db_drop_field() in hook_modules_uninstalled because, when I get plugin definitions for plugins of this type, those provided by the module no longer exist because the module is already uninstalled.

Proposed resolution

To get around this, I propose we add hook_modules_preuninstall, to be invoked prior to any modules being uninstalled. (We may want to add this anyway, for symmetry, since we already have a hook_modules_preinstall).

Remaining tasks

TBD

User interface changes

N/A

API changes

Adding hook_modules_preuninstall().

Comments

iamEAP’s picture

Status: Active » Needs review
StatusFileSize
new1.4 KB

Something like this.

Also, there appears to be a discrepancy between the way hook_modules_preinstall() is invoked and the way it is documented. Opening a separate issue for that; will note it as a related issue.

iamEAP’s picture

Issue summary: View changes

Adding the related issue.

iamEAP’s picture

Issue summary: View changes

Fixing related issue link.

alansaviolobo’s picture

Issue summary: View changes
Status: Needs review » Closed (fixed)

I believe this has already been incorporated into the core.