module_list

includes/module.inc, line 40

Versions
4.6
module_list($refresh = FALSE, $bootstrap = TRUE)
4.7
module_list($refresh = FALSE, $bootstrap = TRUE, $sort = FALSE)
5 – 6
module_list($refresh = FALSE, $bootstrap = TRUE, $sort = FALSE, $fixed_list = NULL)
7
module_list($refresh = FALSE, $sort = FALSE, $fixed_list = NULL)

Collect a list of all loaded modules. During the bootstrap, return only vital modules. See bootstrap.inc

Parameters

$refresh Whether to force the module list to be regenerated (such as after the administrator has changed the system settings).

$bootstrap Whether to return the reduced set of modules loaded in "bootstrap mode" for cached pages. See bootstrap.inc.

Return value

An associative array whose keys and values are the names of all loaded modules.

▾ 26 functions call module_list()

bootstrap_invoke_all in includes/bootstrap.inc
Call all init or exit hooks without including all modules.
file_download in includes/file.inc
Call modules to find out if a file is accessible for a given user.
filter_list_all in modules/filter.module
Build a list of all filters.
form_textarea in includes/common.inc
Format a multiple-line text field.
help_links_as_list in modules/help.module
help_menu in modules/help.module
Implementation of hook_menu().
menu_get_active_help in includes/menu.inc
Returns the help associated with the active menu item.
module_exist in includes/module.inc
Determine whether a given module exists.
module_implements in includes/module.inc
Determine which modules are implementing a hook.
module_iterate in includes/module.inc
Call a function repeatedly with each module in turn as an argument.
module_load_all in includes/module.inc
Load all the modules that have been enabled in the system table.
node_invoke_nodeapi in modules/node.module
Invoke a hook_nodeapi() operation in all modules.
node_list in modules/node.module
Get a list of all the defined node types.
search_admin in modules/search.module
Menu callback; displays the search module settings page.
search_cron in modules/search.module
Implementation of hook_cron().
search_menu in modules/search.module
Implementation of hook_menu().
system_menu in modules/system.module
Implementation of hook_menu().
user_admin_perm in modules/user.module
Menu callback: administer permissions.
user_authenticate in modules/user.module
user_auth_help_links in modules/user.module
user_help in modules/user.module
Implementation of hook_help().
user_module_invoke in modules/user.module
Invokes hook_user() in every module.
user_view in modules/user.module
_block_rehash in modules/block.module
Update the 'blocks' DB table with the blocks currently exported by modules.
_user_categories in modules/user.module
Retrieve a list of all user setting/information categories and sort them by weight.
_user_forms in modules/user.module
Retrieve a list of all form elements for the specified category.

Code

<?php
function module_list($refresh = FALSE, $bootstrap = TRUE) {
  static $list;

  if ($refresh) {
    $list = array();
  }

  if (!$list) {
    $list = array('filter' => 'filter', 'system' => 'system', 'user' => 'user', 'watchdog' => 'watchdog');
    if ($bootstrap) {
      $result = db_query("SELECT name, filename, throttle, bootstrap FROM {system} WHERE type = 'module' AND status = 1 AND bootstrap = 1");
    }
    else {
      $result = db_query("SELECT name, filename, throttle, bootstrap FROM {system} WHERE type = 'module' AND status = 1");
    }
    while ($module = db_fetch_object($result)) {
      if (file_exists($module->filename)) {
        // Determine the current throttle status and see if the module should be
        // loaded based on server load. We have to directly access the throttle
        // variables, since throttle.module may not be loaded yet.
        $throttle = ($module->throttle && variable_get('throttle_level', 0) > 0);
        if (!$throttle) {
          drupal_get_filename('module', $module->name, $module->filename);
          $list[$module->name] = $module->name;
        }
      }
    }
    asort($list);
  }
  return $list;
}
?>
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.