You are here

function module_disable in Drupal 5

Same name and namespace in other branches
  1. 6 includes/module.inc \module_disable()
  2. 7 includes/module.inc \module_disable()

Disable a given set of modules.

Parameters

$module_list: An array of module names.

2 calls to module_disable()
system_modules_submit in modules/system/system.module
Submit callback; handles modules form submission.
system_update_1010 in modules/system/system.install

File

includes/module.inc, line 269
API for loading and interacting with Drupal modules.

Code

function module_disable($module_list) {
  $invoke_modules = array();
  foreach ($module_list as $module) {
    if (module_exists($module)) {
      module_load_install($module);
      module_invoke($module, 'disable');
      db_query("UPDATE {system} SET status = 0, throttle = 0 WHERE type = 'module' AND name = '%s'", $module);
      $invoke_modules[] = $module;
    }
  }
  if (!empty($invoke_modules)) {

    // Refresh the module list to exclude the disabled modules.
    module_list(TRUE, FALSE);

    // Force to regenerate the stored list of hook implementations.
    module_implements('', FALSE, TRUE);
    cache_clear_all('*', 'cache_menu', TRUE);
  }
}