[development] uninstall: deleting all variables of a module
Stefan Borchert
stefan at borchert.cc
Sat Apr 18 14:27:09 UTC 2009
Eric Schaefer schrieb:
> 2009/4/18 Earnie Boyd <earnie at users.sourceforge.net>:
>> db_query(DELETE FROM {variable} WHERE name LIKE '%s_%%', 'scheduler');
>
> I guess thats your way of saying "No nice and easy way" (as in "Drupal
> has save and portable built-in functions for it"). ;-)
http://api.drupal.org/api/function/variable_del/6
<code>
<?php
function remove_all_variables($namespace) {
foreach ($conf as $name => $value)
{
if (strpos($name, $namespace) === 0) {
// Variable starts with given namespace. Delete it.
variable_del($name);
}
}
}
?>
</code>
Nice enough? ;-)
hth,
Stefan
More information about the development
mailing list