You are here

function module_disable in Drupal 6

Same name and namespace in other branches
  1. 5 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.admin.inc
Submit callback; handles modules form submission.
system_update_6018 in modules/system/system.install
Add HTML corrector to HTML formats or replace the old module if it was in use.

File

includes/module.inc, line 349
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)) {

      // Check if node_access table needs rebuilding.
      if (!node_access_needs_rebuild() && module_hook($module, 'node_grants')) {
        node_access_needs_rebuild(TRUE);
      }
      module_load_install($module);
      module_invoke($module, 'disable');
      db_query("UPDATE {system} SET status = %d, throttle = %d WHERE type = '%s' AND name = '%s'", 0, 0, 'module', $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);
  }

  // If there remains no more node_access module, rebuilding will be
  // straightforward, we can do it right now.
  if (node_access_needs_rebuild() && count(module_implements('node_grants')) == 0) {
    node_access_rebuild();
  }
}