This can be solved from implementation of hook_uninstall(). For example:
/**
* Implementation of hook_uninstall().
*/
function vertical_tabs_uninstall() {
// Delete all module variables and then clear the variables cache.
// Note: backslash used because _ is wildcard character in SQL.
db_query("DELETE FROM {variable} WHERE name LIKE 'vertical\_tabs\_%%'");
cache_clear_all('variables', 'cache');
}
Comments
Comment #1
avpadernoThis is still true for the latest development snapshot.
Comment #2
dave reidPlease provide a patch that uses variable_del() or I'll get this done tonight.
Comment #3
dave reidFixed in CVS. http://drupal.org/cvs?commit=285286
Comment #4
markus_petrux commented@todo: hook_node_type() needs to deal with the case where a node type name is renamed.
Out of curiosity, any reason for not using DELETE LIKE in hook_uninstall(). I'm using this pattern on my modules, and now I'm concerned about there's something odd I'm missing?
Comment #5
avpadernoUsing
variable_del(), the code would execute two SQL queries, where one query deletes the content of the cache used for the Drupal variables. When you delete three Drupal variables in row, that query would be executed without any result (for the fact the cache has been already cleared when deleting the first Drupal variable). IMO, considering that the code is in an uninstallation function, it is safe to use an SQL query.Comment #6
dave reid1. Using variable_del for each variable in uninstall is the standard set by core (and still is in Drupal 7). You never know if someone were to create a module named vertical_tabs_better, whose variables would be deleted by this blanket SQL.
2. http://api.drupal.org/api/function/node_type_form_submit/6 actually renames variables itself. I know, strange huh? :) This is why core's comment_node_type does not do this as well. Try it! I dare you!
Comment #7
markus_petrux commentedBoth good points! Thanks! :)
Comment #8
avpadernoA little side note:
vertical_tabs_uninstall()is reported to be an implementation ofhook_install().Comment #9
dave reid@KiamLaLuno: Hah, thanks. It'll get picked up with the next commit.
Comment #10
hass commented@Kiam: nodewords modules... hook_uninstall()... CNW.
Comment #11
avpadernoCNW?
Comment #12
hass commentedAs i often said - use variable_del() in .install files. Nodewords don't use it. Therefore nodewords needs work.
Comment #13
avpadernoThat is not anymore true.