function system_handle_uninstall_module
Search API
7.x system.module | system_handle_uninstall_module() |
6.x system.module | system_handle_uninstall_module() |
4.x system.module | system_handle_uninstall_module() |
5.x system.module | system_handle_uninstall_module() |
Called from the menu (ie, a URL) this function will uninstall a module.
File
- modules/
system/ system.module, line 2106
Code
function system_handle_uninstall_module() {
$module = $_REQUEST ["module"];
// First, let's get information about this module from the db.
$res = db_query("SELECT * FROM modules WHERE name = '?' ", $module);
$cur = db_fetch_array($res);
// Make sure it is not currently enabled.
if ($cur ["enabled"] == "1") {
fp_add_message(t("Module %module not yet disabled. Disable first, then try to uninstall.", array("%module" => $module)));
return;
}
// Let's see if we can call hook_uninstall for this module.
if (include_module($module, TRUE, $cur ["path"])) {
if (include_module_install($module, $cur ["path"])) {
if (function_exists($module . "_uninstall")) {
call_user_func($module . "_uninstall");
}
}
}
// Remove from the database.
$res = db_query("DELETE FROM modules WHERE name = '?' ", $module);
fp_add_message(t("Uninstalled %module.", array("%module" => $module)));
fp_goto("admin/config/modules");
}