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
Related Issues
API changes
Adding hook_modules_preuninstall().
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | drupal-hook_modules_preuninstall-2057641-1.patch | 1.4 KB | iamEAP |
Comments
Comment #1
iamEAP commentedSomething 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.
Comment #1.0
iamEAP commentedAdding the related issue.
Comment #1.1
iamEAP commentedFixing related issue link.
Comment #2
alansaviolobo commentedI believe this has already been incorporated into the core.