It's preferred to explicitly delete every variable created by the module you're uninstalling.<br><br>If you do this in amazon module: "delete from variable where name like 'amazon_%'"<br><br>you will delete the variables for amazon_store as well. Ooops. Not so good.<br>
<br>-Randy<br><br><div class="gmail_quote">On Thu, May 26, 2011 at 4:58 PM, Peter Anderson <span dir="ltr"><<a href="mailto:list@panda.id.au">list@panda.id.au</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div bgcolor="#ffffff" text="#000000">
<font face="sans-serif">Hi all,<br>
<br>
I have a module that uses quite a few variables</font> and would
like to remove them in my hook_uninstall() function, but I don't
want to have to list them all manually...<br>
<br>
I see three ways to do this:<br>
1 - Run variable_del() for each variable manually<br>
2 - List all variables then remove the ones that start with my
module's name<br>
3 - Delete variables directly from the database that start with my
module's name<br>
<br>
I'm obviously trying to avoid #1.<br>
I've used #2 before (<a href="http://drupalbin.com/18718" target="_blank">http://drupalbin.com/18718</a>) but am worried
about the possible performance implications of running a foreach()
on every variable in Drupal... Is this good or not?<br>
I'd prefer not to resort to using SQL to delete variables from the
database directly as in #3, but this may be the only recommended
option...<br>
<br>
What is the recommended way to call variable_del() on a bunch of
variables? I'm using D7 if that helps.<br>
Thanks.<br>
<br>
<pre cols="72">--
Kind regards,
Peter Anderson.
<a href="http://panda.id.au" target="_blank">http://panda.id.au</a>
</pre>
</div>
</blockquote></div><br><br clear="all"><br>-- <br>Randy Fay<br>Drupal Module and Site Development<br><a href="mailto:randy@randyfay.com">randy@randyfay.com</a><br>+1 970.462.7450<br><br>