I have implemented/fixed more some more uinstalls.
Also I have extended variable_del() function to have ability to remove variables with specifying wildcard.
e.g. call to variable_del('upload_', TRUE) will remove all variables that begin with 'upload_' - 'upload_test1', 'upload_test2'.
It makes uninstalls easier.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | var_del_prefix_93528_d8.patch | 2.36 KB | mile23 |
| better-uninstall-handling.patch.txt | 3.62 KB | doq |
Comments
Comment #1
Frando commentedsetting proper states.
Comment #2
profix898 commentedI think you should remove the wildcard functionality from variable_del() for now. New features will not go into Drupal 5 anymore. We also discussed the exact modification to variable_del() some weeks ago and it was rejected.
Comment #3
sunMarking as duplicate of #138544: Allow multiple variable deletes in variable_del()
Comment #4
stokito commented+1
Comment #5
stokito commentedUsing of #138544: Allow multiple variable deletes in variable_del() is stupid. This solution is more powerful.
Comment #6
joshmillerI've looked at this patch and it will need more than porting. I like the feature idea, but I think we need to start from scratch on how to implement.
Comment #7
sun.core commentedProper status.
Comment #8
sun.core commentedComment #9
catchDowngrading all D8 criticals to major per http://drupal.org/node/45111
Comment #10
mile23As per #6: Add a function called variable_del_prefix($prefix). Thus variables named mymodule_foo and mymodule_bar would both be deleted by calling variable_del_prefix('mymodule_');
This has a few main benefits:
1) You can delete all variables in your namespace in one go, without potentially demolishing anything else if you have the wrong wildcard somewhere.
2) It imposes (in a very small way) a best practice on developers, such that they standardize their variable names for convenience in hook_uninstall().
3) It could be refactored for efficiency after #138544: Allow multiple variable deletes in variable_del() finally happens.
4) Easy backport to D7. Which I'd really like to see. Please. O please.
Comment #11
dave reidI actually think this is a bad idea as it could easily blow away unintended variables.
Comment #12
mile23"I actually think this is a bad idea as it could easily blow away unintended variables."
Which unintended variables would those be? The ones that someone else set with my module name as their namespace? variable_del() suffers from the same problem. :-)
Comment #13
catchviews vs. views_bulk_operations
image vs. imagecache.
Comment #14
wim leersComment #15
mile23I'm going to go out on a limb and say this is no longer a thing.
Comment #16
catchYes we can call this a duplicate of state/CMI.