? files Index: install.php =================================================================== RCS file: /cvs/drupal/drupal/install.php,v retrieving revision 1.40 diff -u -p -r1.40 install.php --- install.php 25 Mar 2007 23:34:17 -0000 1.40 +++ install.php 2 Apr 2007 13:32:06 -0000 @@ -40,9 +40,6 @@ function install_main() { // Load module basics (needed for hook invokes). include_once './includes/module.inc'; - $module_list['system']['filename'] = 'modules/system/system.module'; - $module_list['filter']['filename'] = 'modules/filter/filter.module'; - module_list(TRUE, FALSE, FALSE, $module_list); drupal_load('module', 'system'); drupal_load('module', 'filter'); Index: update.php =================================================================== RCS file: /cvs/drupal/drupal/update.php,v retrieving revision 1.214 diff -u -p -r1.214 update.php --- update.php 28 Mar 2007 07:02:47 -0000 1.214 +++ update.php 2 Apr 2007 13:32:06 -0000 @@ -343,7 +343,7 @@ function update_script_selection_form() // Ensure system.module's updates appear first $form['start']['system'] = array(); - foreach (module_list() as $module) { + foreach (module_list_all() as $module) { $updates = drupal_get_schema_versions($module); if ($updates !== FALSE) { $updates = drupal_map_assoc($updates); Index: includes/bootstrap.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v retrieving revision 1.151 diff -u -p -r1.151 bootstrap.inc --- includes/bootstrap.inc 28 Mar 2007 14:08:21 -0000 1.151 +++ includes/bootstrap.inc 2 Apr 2007 13:32:06 -0000 @@ -470,7 +470,7 @@ function page_get_cache() { * The name of the bootstrap hook we wish to invoke. */ function bootstrap_invoke_all($hook) { - foreach (module_list(TRUE, TRUE) as $module) { + foreach (module_list_bootstrap(FALSE, TRUE) as $module) { drupal_load('module', $module); module_invoke($module, $hook); } Index: includes/install.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/install.inc,v retrieving revision 1.35 diff -u -p -r1.35 install.inc --- includes/install.inc 27 Mar 2007 05:13:53 -0000 1.35 +++ includes/install.inc 2 Apr 2007 13:32:07 -0000 @@ -22,7 +22,7 @@ define('FILE_NOT_EXECUTABLE', 128); * Initialize the update system by loading all installed module's .install files. */ function drupal_load_updates() { - foreach (module_list() as $module) { + foreach (module_list_all() as $module) { module_load_install($module); } } Index: includes/menu.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/menu.inc,v retrieving revision 1.159 diff -u -p -r1.159 menu.inc --- includes/menu.inc 27 Mar 2007 05:13:53 -0000 1.159 +++ includes/menu.inc 2 Apr 2007 13:32:07 -0000 @@ -528,7 +528,7 @@ function menu_get_active_help() { return; } - foreach (module_list() as $name) { + foreach (module_list_all() as $name) { if (module_hook($name, 'help')) { if ($temp = module_invoke($name, 'help', $path)) { $output .= $temp ."\n"; Index: includes/module.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/module.inc,v retrieving revision 1.98 diff -u -p -r1.98 module.inc --- includes/module.inc 4 Feb 2007 21:20:50 -0000 1.98 +++ includes/module.inc 2 Apr 2007 13:32:07 -0000 @@ -10,7 +10,7 @@ * Load all the modules that have been enabled in the system table. */ function module_load_all() { - foreach (module_list(TRUE, FALSE) as $module) { + foreach (module_list_all(TRUE) as $module) { drupal_load('module', $module); } } @@ -19,64 +19,93 @@ function module_load_all() { * Call a function repeatedly with each module in turn as an argument. */ function module_iterate($function, $argument = '') { - foreach (module_list() as $name) { + foreach (module_list_all() as $name) { $function($name, $argument); } } /** - * Collect a list of all loaded modules. During the bootstrap, return only - * vital modules. See bootstrap.inc + * Collect a list of all loaded modules. * * @param $refresh * Whether to force the module list to be regenerated (such as after the * administrator has changed the system settings). - * @param $bootstrap - * Whether to return the reduced set of modules loaded in "bootstrap mode" - * for cached pages. See bootstrap.inc. * @param $sort - * By default, modules are ordered by weight and filename, settings this option - * to TRUE, module list will be ordered by module name. - * @param $fixed_list - * (Optional) Override the module list with the given modules. Stays until the - * next call with $refresh = TRUE. + * By default, modules are ordered by weight and filename, settings this + * option to TRUE, module list will be ordered by module name. * @return * An associative array whose keys and values are the names of all loaded * modules. */ -function module_list($refresh = FALSE, $bootstrap = TRUE, $sort = FALSE, $fixed_list = NULL) { - static $list, $sorted_list; +function module_list_all($refresh = FALSE, $sort = FALSE) { + static $list = array(), $sorted_list; - if ($refresh || $fixed_list) { + if ($refresh || empty($list)) { unset($sorted_list); - $list = array(); - if ($fixed_list) { - foreach ($fixed_list as $name => $module) { - drupal_get_filename('module', $name, $module['filename']); - $list[$name] = $name; + + $result = db_query("SELECT name, filename, throttle, bootstrap FROM {system} WHERE type = 'module' AND status = 1 ORDER BY weight ASC, filename ASC"); + + 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; + } } } - else { - if ($bootstrap) { - $result = db_query("SELECT name, filename, throttle, bootstrap FROM {system} WHERE type = 'module' AND status = 1 AND bootstrap = 1 ORDER BY weight ASC, filename ASC"); - } - else { - $result = db_query("SELECT name, filename, throttle, bootstrap FROM {system} WHERE type = 'module' AND status = 1 ORDER BY weight ASC, filename ASC"); - } - 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; - } - } + } + + if ($sort) { + if (!isset($sorted_list)) { + $sorted_list = $list; + ksort($sorted_list); + } + return $sorted_list; + } + + return $list; +} + +/** + * Collect a list of loaded modules that have been identified as needed for + * bootstrap procedures. + * + * @param $refresh + * Whether to force the module list to be regenerated (such as after the + * administrator has changed the system settings). + * @param $sort + * By default, modules are ordered by weight and filename, settings this + * option to TRUE, module list will be ordered by module name. + * @return + * An associative array whose keys and values are the names of all loaded + * modules. + */ +function module_list_bootstrap($refresh = FALSE, $sort = FALSE) { + static $list = array(), $sorted_list; + + if ($refresh || empty($list)) { + unset($sorted_list); + + $result = db_query("SELECT name, filename, throttle, bootstrap FROM {system} WHERE type = 'module' AND status = 1 AND bootstrap = 1 ORDER BY weight ASC, filename ASC"); + + 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; + } } } } + if ($sort) { if (!isset($sorted_list)) { $sorted_list = $list; @@ -84,6 +113,7 @@ function module_list($refresh = FALSE, $ } return $sorted_list; } + return $list; } @@ -215,7 +245,7 @@ function _module_parse_info_file($filena * TRUE if the module is both installed and enabled. */ function module_exists($module) { - $list = module_list(); + $list = module_list_all(); return array_key_exists($module, $list); } @@ -252,7 +282,8 @@ function module_enable($module_list) { if (!empty($invoke_modules)) { // Refresh the module list to include the new enabled module. - module_list(TRUE, FALSE); + module_list_all(TRUE); + module_list_bootstrap(TRUE); // Force to regenerate the stored list of hook implementations. module_implements('', FALSE, TRUE); } @@ -281,7 +312,8 @@ function module_disable($module_list) { if (!empty($invoke_modules)) { // Refresh the module list to exclude the disabled modules. - module_list(TRUE, FALSE); + module_list_all(TRUE); + module_list_bootstrap(TRUE); // Force to regenerate the stored list of hook implementations. module_implements('', FALSE, TRUE); } @@ -348,7 +380,7 @@ function module_implements($hook, $sort if (!isset($implementations[$hook])) { $implementations[$hook] = array(); - $list = module_list(FALSE, TRUE, $sort); + $list = module_list_all(FALSE, $sort); foreach ($list as $module) { if (module_hook($module, $hook)) { $implementations[$hook][] = $module; Index: modules/block/block.module =================================================================== RCS file: /cvs/drupal/drupal/modules/block/block.module,v retrieving revision 1.254 diff -u -p -r1.254 block.module --- modules/block/block.module 27 Mar 2007 05:13:53 -0000 1.254 +++ modules/block/block.module 2 Apr 2007 13:32:07 -0000 @@ -153,7 +153,7 @@ function _block_rehash() { $blocks = array(); - foreach (module_list() as $module) { + foreach (module_list_all() as $module) { $module_blocks = module_invoke($module, 'block', 'list'); if ($module_blocks) { foreach ($module_blocks as $delta => $block) { Index: modules/filter/filter.module =================================================================== RCS file: /cvs/drupal/drupal/modules/filter/filter.module,v retrieving revision 1.166 diff -u -p -r1.166 filter.module --- modules/filter/filter.module 12 Mar 2007 11:31:02 -0000 1.166 +++ modules/filter/filter.module 2 Apr 2007 13:32:07 -0000 @@ -634,7 +634,7 @@ function filter_formats($index = NULL) { function filter_list_all() { $filters = array(); - foreach (module_list() as $module) { + foreach (module_list_all() as $module) { $list = module_invoke($module, 'filter', 'list'); if (isset($list) && is_array($list)) { foreach ($list as $delta => $name) { Index: modules/search/search.module =================================================================== RCS file: /cvs/drupal/drupal/modules/search/search.module,v retrieving revision 1.216 diff -u -p -r1.216 search.module --- modules/search/search.module 27 Mar 2007 05:13:54 -0000 1.216 +++ modules/search/search.module 2 Apr 2007 13:32:07 -0000 @@ -205,7 +205,7 @@ function search_admin_settings() { // Collect some stats $remaining = 0; $total = 0; - foreach (module_list() as $module) { + foreach (module_list_all() as $module) { if (module_hook($module, 'search')) { $status = module_invoke($module, 'search', 'status'); $remaining += $status['remaining']; @@ -303,7 +303,7 @@ function search_cron() { register_shutdown_function('search_update_totals'); // Update word index - foreach (module_list() as $module) { + foreach (module_list_all() as $module) { module_invoke($module, 'update_index'); } } Index: modules/system/system.install =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.install,v retrieving revision 1.88 diff -u -p -r1.88 system.install --- modules/system/system.install 30 Mar 2007 08:47:58 -0000 1.88 +++ modules/system/system.install 2 Apr 2007 13:32:08 -0000 @@ -144,7 +144,7 @@ function system_requirements($phase) { ); // Check installed modules. - foreach (module_list() as $module) { + foreach (module_list_all() as $module) { $updates = drupal_get_schema_versions($module); if ($updates !== FALSE) { $default = drupal_get_installed_schema_version($module); Index: modules/system/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.module,v retrieving revision 1.460 diff -u -p -r1.460 system.module --- modules/system/system.module 27 Mar 2007 05:13:54 -0000 1.460 +++ modules/system/system.module 2 Apr 2007 13:32:08 -0000 @@ -1487,7 +1487,7 @@ function system_modules_submit($form_id, } } - $old_module_list = module_list(); + $old_module_list = module_list_all(); if (!empty($enable_modules)) { module_enable($enable_modules); @@ -1504,7 +1504,7 @@ function system_modules_submit($form_id, } drupal_install_modules($new_modules); - $current_module_list = module_list(TRUE, FALSE); + $current_module_list = module_list_all(TRUE); if (isset($form_values['throttle'])) { foreach ($form_values['throttle'] as $key => $choice) { Index: modules/user/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.module,v retrieving revision 1.763 diff -u -p -r1.763 user.module --- modules/user/user.module 30 Mar 2007 07:45:19 -0000 1.763 +++ modules/user/user.module 2 Apr 2007 13:32:08 -0000 @@ -16,7 +16,7 @@ define('EMAIL_MAX_LENGTH', 64); * be passed by reference. */ function user_module_invoke($type, &$array, &$user, $category = NULL) { - foreach (module_list() as $module) { + foreach (module_list_all() as $module) { $function = $module .'_user'; if (function_exists($function)) { $function($type, $array, $user, $category); @@ -965,7 +965,7 @@ function user_set_authmaps($account, $au function user_auth_help_links() { $links = array(); - foreach (module_list() as $module) { + foreach (module_list_all() as $module) { if (module_hook($module, 'auth')) { $links[] = l(module_invoke($module, 'info', 'name'), 'user/help', array('fragment' => $module)); } @@ -1612,7 +1612,7 @@ function user_view($account) { drupal_set_title(check_plain($account->name)); // Retrieve and merge all profile fields: $fields = array(); - foreach (module_list() as $module) { + foreach (module_list_all() as $module) { if ($data = module_invoke($module, 'user', 'view', '', $account)) { foreach ($data as $category => $items) { foreach ($items as $key => $item) { @@ -1912,7 +1912,7 @@ function user_admin_perm($rid = NULL) { // Render role/permission overview: $options = array(); - foreach (module_list(FALSE, FALSE, TRUE) as $module) { + foreach (module_list_all(FALSE, TRUE) as $module) { if ($permissions = module_invoke($module, 'perm')) { $form['permission'][] = array( '#value' => $module, @@ -2498,7 +2498,7 @@ function user_help($section) {

One of the more tedious moments in visiting a new website is filling out the registration form. Here at @site, you do not have to fill out a registration form if you are already a member of !affiliate-info. This capability is called distributed authentication, and Drupal, the software which powers @site, fully supports it.

Distributed authentication enables a new user to input a username and password into the login box, and immediately be recognized, even if that user never registered at @site. This works because Drupal knows how to communicate with external registration databases. For example, lets say that new user \'Joe\' is already a registered member of Delphi Forums. Drupal informs Joe on registration and login screens that he may login with his Delphi ID instead of registering with @site. Joe likes that idea, and logs in with a username of joe@remote.delphiforums.com and his usual Delphi password. Drupal then contacts the remote.delphiforums.com server behind the scenes (usually using XML-RPC, HTTP POST, or SOAP) and asks: "Is the password for user Joe correct?". If Delphi replies yes, then we create a new @site account for Joe and log him into it. Joe may keep on logging into @site in the same manner, and he will always be logged into the same account.

', array('!affiliate-info' => $affiliate_info, '@site' => $site, '@drupal' => 'http://drupal.org', '@delphi-forums' => 'http://www.delphiforums.com', '@xml' => 'http://www.xmlrpc.com', '@http-post' => 'http://www.w3.org/Protocols/', '@soap' => 'http://www.soapware.org')); - foreach (module_list() as $module) { + foreach (module_list_all() as $module) { if (module_hook($module, 'auth')) { $output .= "

". module_invoke($module, 'info', 'name') .'

'; $output .= module_invoke($module, 'help', "user/help#$module"); @@ -2523,7 +2523,7 @@ function user_help_page() { function _user_categories($account) { $categories = array(); - foreach (module_list() as $module) { + foreach (module_list_all() as $module) { if ($data = module_invoke($module, 'user', 'categories', NULL, $account, '')) { $categories = array_merge($data, $categories); } @@ -2545,7 +2545,7 @@ function _user_sort($a, $b) { */ function _user_forms(&$edit, $account, $category, $hook = 'form') { $groups = array(); - foreach (module_list() as $module) { + foreach (module_list_all() as $module) { if ($data = module_invoke($module, 'user', $hook, $edit, $account, $category)) { $groups = array_merge_recursive($data, $groups); } @@ -2589,7 +2589,7 @@ function user_filters() { $options = array(); $t_module = t('module'); - foreach (module_list() as $module) { + foreach (module_list_all() as $module) { if ($permissions = module_invoke($module, 'perm')) { asort($permissions); foreach ($permissions as $permission) {