...
This works for version 5.x and 6.x modules.
Code Block |
---|
borderStyle | solid |
---|
title | modulename.install | borderStyle | solid |
---|
|
<?php
function modulename_uninstall() {
// remove module system variables
$module_name = 'modulename';
$vars = db_query("select * from {variable} where name like '" . $module_name . "%'");
while ($var = db_fetch_object($vars)) {
variable_del($var->name);
}
}
|
Renaming system variables when changing module name
Code Block |
---|
borderStyle | solid |
---|
title | modulename.install | borderStyle | solid |
---|
|
<?php
function newmodulename_install() {
// rename module system variables
$oldname = 'modulename';
$newname = 'newmodulename';
$vars = db_query("select * from {variable} where name like '" . $oldname . "%'");
while ($var = db_fetch_object($vars)) {
$newvar = str_replace($oldname,$newname,$var->name);
variable_set($newvar, variable_get($var->name, NULL));
variable_del($var->name);
}
}
|