Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.762 diff -u -p -r1.762 common.inc --- includes/common.inc 31 Mar 2008 20:50:05 -0000 1.762 +++ includes/common.inc 1 Apr 2008 07:02:52 -0000 @@ -1463,6 +1463,8 @@ function drupal_page_footer() { if (variable_get('cache', CACHE_DISABLED) != CACHE_DISABLED) { page_set_cache(); } + // Store the used registry files. + registry_mark_file(NULL, TRUE); module_invoke_all('exit'); } @@ -2441,6 +2443,9 @@ function _drupal_bootstrap_full() { unicode_check(); // Undo magic quotes fix_gpc_magic(); + // Register autoload functions so that we can access classes and interfaces. + spl_autoload_register('registry_check_class'); + spl_autoload_register('registry_check_interface'); // Load all enabled modules module_load_all(); // Let all modules take action before menu system handles the request @@ -2698,7 +2703,7 @@ function drupal_render(&$elements) { // element is rendered into the final text. if (isset($elements['#pre_render'])) { foreach ($elements['#pre_render'] as $function) { - if (function_exists($function)) { + if (registry_check_function($function)) { $elements = $function($elements); } } @@ -2760,7 +2765,7 @@ function drupal_render(&$elements) { // which allows the output'ed text to be filtered. if (isset($elements['#post_render'])) { foreach ($elements['#post_render'] as $function) { - if (function_exists($function)) { + if (registry_check_function($function)) { $content = $function($content, $elements); } } @@ -3140,7 +3145,7 @@ function drupal_uninstall_schema($module */ function drupal_get_schema_unprocessed($module, $table = NULL) { // Load the .install file to get hook_schema. - module_load_include('install', $module); + module_load_install($module); $schema = module_invoke($module, 'schema'); if (!is_null($table) && isset($schema[$table])) { @@ -3526,6 +3531,10 @@ function drupal_flush_all_caches() { // Change query-strings on css/js files to enforce reload for all users. _drupal_flush_css_js(); + // Because the registry is rebuilt before the registry cache is cleared, + // there should be nearly no risk of someone visiting the site and finding an + // empty registry. + drupal_rebuild_code_registry(); drupal_clear_css_cache(); drupal_clear_js_cache(); system_theme_data(); @@ -3534,7 +3543,7 @@ function drupal_flush_all_caches() { node_types_rebuild(); // Don't clear cache_form - in-progress form submissions may break. // Ordered so clearing the page cache will always be the last action. - $core = array('cache', 'cache_block', 'cache_filter', 'cache_page'); + $core = array('cache', 'cache_block', 'cache_filter', 'cache_registry', 'cache_page'); $cache_tables = array_merge(module_invoke_all('flush_caches'), $core); foreach ($cache_tables as $table) { cache_clear_all('*', $table, TRUE); @@ -3559,3 +3568,401 @@ function _drupal_flush_css_js() { } variable_set('css_js_query_string', $new_character . substr($string_history, 0, 19)); } + +/** + * @defgroup registry Code registry + * @{ + * The code registry engine. + * + * Drupal maintains an internal registry of all functions or classes in the + * system, allowing it to lazy-load code files as needed (reducing the amount + * of code that must be parsed on each request). The list of included files is + * cached per menu callback for subsequent loading by the menu router. This way, + * a given page request will have all the code it needs but little else, minimizing + * time spent parsing unneeded code. + */ + +/** + * Rescan all enabled modules and rebuild the registry. + * + * Rescans all code in modules or includes directory, storing a mapping of + * each function, file, and hook implementation in the database. + */ +function drupal_rebuild_code_registry() { + // Flush the old registry. + db_query("DELETE FROM {registry}"); + // We can't rely on the registry-based module_implements code, so we set + // "dumb mode". + module_implements('', FALSE, FALSE, TRUE); + $list = module_list(TRUE, FALSE, FALSE); + $patterns = array(); + foreach (module_invoke_all('hooks') as $pattern) { + // For example 'form__alter'. + $patterns[] = '/'. str_replace('__', '_.*_', $pattern) .'/'; + } + + foreach ($list as $module) { + _registry_parse_directory(drupal_get_path('module', $module), $patterns); + } + + _registry_parse_directory('includes', $patterns); + $implementations = _registry_hook_implementations(); + cache_set('hooks', array('patterns' => $patterns, 'implementations' => $implementations)); + module_implements('', FALSE, FALSE, FALSE); +} + +/** + * Parse all loadable files in a directory and save their function and class listings. + * + * @param $path + * The path relative to Drupal root to scan. + * @param $patterns + * The function pattern to identify as a hook. This allows to record what hook + * implementations exist, and in what module or file. + */ +function _registry_parse_directory($path, $patterns) { + static $map = array(T_FUNCTION => 'function', T_CLASS => 'class', T_INTERFACE => 'interface'); + + $active_modules = module_list(); + + $files = file_scan_directory($path, '\.(inc|module|install)$'); + foreach ($files as $filename => $file) { + $tokens = token_get_all(file_get_contents($filename)); + while ($token = next($tokens)) { + // Ignore all tokens except for those we are specifically saving. + if (is_array($token) && isset($map[$token[0]])) { + $type = $map[$token[0]]; + if ($resource_name = _registry_get_resource_name($tokens, $type)) { + $module = _registry_get_resource_module($resource_name, $filename, $type); + if ($module != 'includes' && !in_array($module, $active_modules)) { + // If this is a disabled module then we skip the entire file. + continue 2; + } + $hook = _registry_get_resource_hook($resource_name, $module, $patterns); + + // Now save the resource record to the database. + $result = _registry_save_resource($resource_name, $type, $module, $hook, $filename); + // We skip the body because classes may contain functions. + _registry_skip_body($tokens); + } + } + } + } +} + +/** + * Derive the name of the next resource in the token stream. + * + * @param $tokens + * The collection of tokens for the current file being parsed. + * @param $type + * The human-readable token name, either: "function", "class", or "interface". + * @return + * The name of the resource, or FALSE if the resource has already been processed. + */ +function _registry_get_resource_name(&$tokens, $type) { + // Keep a running list of all resources we've saved so far, so that we never + // save one more than once. + static $resources; + + // Determine the name of the resource. + next($tokens); // Eat a space. + $token = next($tokens); + if ($token == '&') { + $token = next($tokens); + } + $resource_name = $token[1]; + + // Ensure that we never save it more than once. + if (isset($resources[$type][$resource_name])) { + return FALSE; + } + $resources[$type][$resource_name] = TRUE; + + return $resource_name; +} + +/** + * Determine the module to which a given resource belongs. + * + * In the case of node "hooks", the module is determined by calculating all + * possible node hooks with their corresponding module. Otherwise, the module + * is derived from the file name or directory name of the file. + * + * Detectable files follow one of the following patterns: + * - .module + * - .install + * - ..inc + * - /.inc + * + * Note that the last option will treat any code in Drupal's core "includes" + * directory as belonging to the module "includes". This is by design. + * + * In order for a module to provide a hook on behalf of another module, the + * name of the file containing the implementation must match the module the hook + * applies to, not the providing module. That is, if module foo provides the + * implementation of hook_example() on behalf of module bar, then the function + * must reside in foo/bar.something.inc for it to associate with module bar + * correctly. + * + * @param $resource_name + * The name of the resource; the function or class name. + * @param $filename + * The name of the file in which the resource resides, relative to Drupal root. + * @param $type + * A string, possible values are function, class, interface. + * @return + * The name of the module that "owns" the resource. + */ +function _registry_get_resource_module($resource_name, $filename, $type) { + static $dirs, $node_functions; + + // Node "hooks" aren't "real hooks", but still get called indirectly. Therefore, + // we build up a list of all possible node hooks for the current node types + // to match against later. + if (empty($node_functions)) { + $types = node_get_types(); + foreach ($types as $node_type) { + $module = $node_type->module == 'node' ? 'node_content' : $node_type->module; + foreach (array('load', 'validate', 'insert', 'update', 'delete', 'view', 'prepare', 'form') as $hook) { + $node_functions[$module .'_'. $hook] = $module; + } + } + } + + // Extract the module from the file name or directory name. + $file_parts = explode('.', $filename); + $module = ''; + $hook = ''; + $count = count($file_parts); + if (isset($node_functions[$resource_name]) && $type == 'function') { + $module = $node_functions[$resource_name]; + } + else { + if ($count == 2 && $file_parts[1] == 'inc') { + if (!isset($dirs[$filename])) { + $dir_parts = explode('/', $file_parts[0]); + array_pop($dir_parts); + $dirs[$filename] = array_pop($dir_parts); + } + $module = $dirs[$filename]; + } + if (($count == 2 && ($file_parts[1] == 'module' || $file_parts[1] == 'install')) || ($count == 3 && $file_parts[2] == 'inc')) { + $module = basename($file_parts[0]); + } + } + + return $module; +} + +/** + * Determine what hook this resource could be an implementation for. + * + * We record the hook for a given function so that we can easily request, + * in a single query, all hook implementations for a given hook. In most + * cases, this is a simple mapping. However, Drupal also supports dynamic + * hook names, such as hook_form_$form_id_alter. For those, we use + * module-provided patterns from hook_hooks() to determine the dynamic hook + * corresponding to this resource. + * + * Note that this mechanism generates false-positives for functions that + * are not actually hook implementations. This is OK, because they will never + * be queried by hook anyway. + * + * @param $resource_name + * The name of the resource; the function or class name. + * @param $module + * The name of the module providing the resource. + * @param $patterns + * A list of dynamic hook patterns to match against. + * @return + * The hook for which this resource is a potential implementation. + */ +function _registry_get_resource_hook($resource_name, $module, $patterns) { + $hook = ''; + if ($module && strpos($resource_name, $module) === 0) { + $hook = substr($resource_name, strlen($module) + 1); + foreach ($patterns as $pattern) { + if (preg_match($pattern, $hook)) { + // If it is a dynamic hook, queue up that information for later caching. + _registry_hook_implementations($hook, $module); + } + } + } + return $hook; +} + +/** + * Save a resource into the database. + * + * @param $resource_name + * The name of the resource; the function or class name. + * @param $type + * The human-readable token name, either "function", "class", or "interface". + * @param $module + * The name of the module providing the resource. + * @param $hook + * The hook this resource is an implementation for. + * @param $filename + * The name of the file where the resource resides, relative to Drupal root. + */ +function _registry_save_resource($resource_name, $type, $module, $hook, $filename) { + db_query("INSERT INTO {registry} (name, type, module, hook, file) VALUES ('%s', '%s', '%s', '%s', '%s')", array($resource_name, $type, $module, $hook, "./$filename")); +} + +/** + * Store the hook/module implementation information that we need to cache. + */ +function _registry_hook_implementations($hook = NULL, $module = NULL) { + static $implementations; + + if (isset($hook)) { + $implementations[$hook][] = $module; + } + else { + return $implementations; + } +} + +/** + * Skip the body of a code block, as defined by { and }. + * + * This function assumes that the body starts at the next instance + * of { from the current position. + * + * @param $tokens + */ +function _registry_skip_body(&$tokens) { + $num_braces = 1; + + $token = ''; + // Get to the first open brace. + while ($token != '{' && ($token = next($tokens))); + + // Scan through the rest of the tokens until we reach the matching + // end brace. + while ($num_braces && ($token = next($tokens))) { + if ($token == '{') { + ++$num_braces; + } + elseif ($token == '}') { + --$num_braces; + } + } +} + +/** + * Collect the files included, so that they can be preloaded on the next + * pageload. + * + * The function collects the files as the registry includes them. At the + * end of the page request it stores them per router path. + * + * @param $file + * A file or an array of files included. + * @param $store + * If true, then store the collected array of files into the database as + * necessary. + */ +function registry_mark_file($file = NULL, $store = FALSE) { + static $used_files = array(), $original_files = array(); + + if (isset($file)) { + if (is_array($file)) { + if (empty($original_files)) { + $original_files = $file; + } + $used_files = array_merge($used_files, $file); + } + else { + $used_files[] = $file; + } + } + elseif ($store && $used_files != $original_files && $_SERVER['REQUEST_METHOD'] == 'GET') { + // Files we will likely need next time. + $files = array_unique($used_files); + // Faster and more memory-efficient than serialize. + $files = implode(';', $files); + $menu = menu_get_item(); + cache_set($menu['path'], $files, 'cache_registry'); + } +} + +/** + * Confirm that a function is available. + * + * If the function is already available, this function does nothing. + * If the function is not available, it tries to load the file where the + * function lives. If the file is not available, it returns false, so that it + * can be used as a drop-in replacement for function_exists(). + * + * @param $function + * The name of the function to check or load. + * @return + * TRUE if the function is now available, FALSE otherwise. + */ +function registry_check_function($function) { + static $checked = array(); + if (isset($checked[$function])) { + return $checked[$function]; + } + if (!function_exists($function)) { + $file = db_result(db_query("SELECT file FROM {registry} WHERE name = '%s' AND type = '%s'", array($function, 'function'))); + if (!$file) { + $checked[$function] = FALSE; + return FALSE; + } + require_once($file); + registry_mark_file($file); + } + $checked[$function] = TRUE; + return TRUE; +} + +/** + * Confirm that a class is available. + * + * This function parallels registry_check_function(), but is rarely + * called directly. Instead, it is registered as an spl_autoload() + * handler, and PHP calls it for us when necessary. + * + * @param $class + * The name of the class to check or load. + * @return + * TRUE if the class is currently available, FALSE otherwise. + */ +function registry_check_class($class) { + $file = db_result(db_query("SELECT file FROM {registry} WHERE name = '%s' AND type = '%s'", array($class, 'class'))); + if (!$file) { + return FALSE; + } + require_once($file); + registry_mark_file($file); + return TRUE; +} + +/** + * Confirm that an interface is available. + * + * This function parallels registry_check_function(), but is rarely + * called directly. Instead, it is registered as an spl_autoload() + * handler, and PHP calls it for us when necessary. + * + * @param $interface + * The name of the interface to check or load. + * @return + * TRUE if the interface is currently available, FALSE otherwise. + */ +function registry_check_interface($interface) { + $file = db_result(db_query("SELECT file FROM {registry} WHERE name = '%s' AND type = '%s'", array($interface, 'interface'))); + if (!$file) { + return FALSE; + } + require_once($file); + registry_mark_file($file); + return TRUE; +} + +/** + * @} End of "defgroup registry". + */ Index: includes/form.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/form.inc,v retrieving revision 1.268 diff -u -p -r1.268 form.inc --- includes/form.inc 15 Mar 2008 11:02:47 -0000 1.268 +++ includes/form.inc 1 Apr 2008 07:02:55 -0000 @@ -326,7 +326,7 @@ function drupal_retrieve_form($form_id, // We first check to see if there's a function named after the $form_id. // If there is, we simply pass the arguments on to it to get the form. - if (!function_exists($form_id)) { + if (!registry_check_function($form_id)) { // In cases where many form_ids need to share a central constructor function, // such as the node editing form, modules can implement hook_forms(). It // maps one or more form_ids to the correct constructor functions. @@ -347,6 +347,7 @@ function drupal_retrieve_form($form_id, } if (isset($form_definition['callback'])) { $callback = $form_definition['callback']; + registry_check_function($callback); } } @@ -503,13 +504,13 @@ function drupal_prepare_form($form_id, & $form += _element_info('form'); if (!isset($form['#validate'])) { - if (function_exists($form_id .'_validate')) { + if (registry_check_function($form_id .'_validate')) { $form['#validate'] = array($form_id .'_validate'); } } if (!isset($form['#submit'])) { - if (function_exists($form_id .'_submit')) { + if (registry_check_function($form_id .'_submit')) { // We set submit here so that it can be altered. $form['#submit'] = array($form_id .'_submit'); } @@ -711,7 +712,7 @@ function _form_validate($elements, &$for // #value data. elseif (isset($elements['#element_validate'])) { foreach ($elements['#element_validate'] as $function) { - if (function_exists($function)) { + if (registry_check_function($function)) { $function($elements, $form_state, $complete_form); } } @@ -748,7 +749,7 @@ function form_execute_handlers($type, &$ } foreach ($handlers as $function) { - if (function_exists($function)) { + if (registry_check_function($function)) { if ($type == 'submit' && ($batch =& batch_get())) { // Some previous _submit handler has set a batch. We store the call // in a special 'control' batch set, for execution at the correct @@ -1031,7 +1032,7 @@ function _form_builder_handle_input_elem // checkboxes and files. if (isset($form['#process']) && !$form['#processed']) { foreach ($form['#process'] as $process) { - if (function_exists($process)) { + if (registry_check_function($process)) { $form = $process($form, isset($edit) ? $edit : NULL, $form_state, $complete_form); } } Index: includes/install.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/install.inc,v retrieving revision 1.58 diff -u -p -r1.58 install.inc --- includes/install.inc 12 Feb 2008 13:45:16 -0000 1.58 +++ includes/install.inc 1 Apr 2008 07:02:55 -0000 @@ -326,7 +326,11 @@ function drupal_install_modules($module_ } while ($moved); asort($module_list); $module_list = array_keys($module_list); + // During install, we do not want to use the registry-based module_implements + // code. + module_implements('', FALSE, FALSE, TRUE); array_filter($module_list, '_drupal_install_module'); + module_implements('', FALSE, FALSE, FALSE); module_enable($module_list); } @@ -687,8 +691,9 @@ function drupal_check_profile($profile) $requirements = array(); foreach ($installs as $install) { require_once $install->filename; - if (module_hook($install->name, 'requirements')) { - $requirements = array_merge($requirements, module_invoke($install->name, 'requirements', 'install')); + $function = $install->name. '_requirements'; + if (function_exists($function)) { + $requirements = array_merge($requirements, $function('install')); } } return $requirements; Index: includes/mail.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/mail.inc,v retrieving revision 1.10 diff -u -p -r1.10 mail.inc --- includes/mail.inc 15 Mar 2008 11:59:37 -0000 1.10 +++ includes/mail.inc 1 Apr 2008 07:02:56 -0000 @@ -115,7 +115,7 @@ function drupal_mail($module, $key, $to, // Build the e-mail (get subject and body, allow additional headers) by // invoking hook_mail() on this module. We cannot use module_invoke() as // we need to have $message by reference in hook_mail(). - if (function_exists($function = $module .'_mail')) { + if (registry_check_function($function = $module .'_mail')) { $function($key, $message, $params); } Index: includes/menu.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/menu.inc,v retrieving revision 1.267 diff -u -p -r1.267 menu.inc --- includes/menu.inc 21 Mar 2008 08:32:24 -0000 1.267 +++ includes/menu.inc 1 Apr 2008 07:02:57 -0000 @@ -339,11 +339,18 @@ function menu_execute_active_handler($pa menu_rebuild(); } if ($router_item = menu_get_item($path)) { + $cache = cache_get($router_item['path'], 'cache_registry'); + if (!empty($cache->data)) { + $files = explode(';', $cache->data); + foreach($files as $file) { + require_once($file); + } + registry_mark_file($files); + } if ($router_item['access']) { - if ($router_item['file']) { - require_once($router_item['file']); + if (registry_check_function($router_item['page_callback'])) { + return call_user_func_array($router_item['page_callback'], $router_item['page_arguments']); } - return call_user_func_array($router_item['page_callback'], $router_item['page_arguments']); } else { return MENU_ACCESS_DENIED; @@ -2198,12 +2205,12 @@ function _menu_router_build($callbacks) $load_functions[$k] = NULL; } else { - if (function_exists($matches[1] .'_to_arg')) { + if (registry_check_function($matches[1] .'_to_arg')) { $to_arg_functions[$k] = $matches[1] .'_to_arg'; $load_functions[$k] = NULL; $match = TRUE; } - if (function_exists($matches[1] .'_load')) { + if (registry_check_function($matches[1] .'_load')) { $function = $matches[1] .'_load'; // Create an array of arguments that will be passed to the _load // function when this menu path is checked, if 'load arguments' @@ -2289,12 +2296,6 @@ function _menu_router_build($callbacks) if (!isset($item['page arguments']) && isset($parent['page arguments'])) { $item['page arguments'] = $parent['page arguments']; } - if (!isset($item['file']) && isset($parent['file'])) { - $item['file'] = $parent['file']; - } - if (!isset($item['file path']) && isset($parent['file path'])) { - $item['file path'] = $parent['file path']; - } } } } @@ -2322,34 +2323,25 @@ function _menu_router_build($callbacks) 'tab_parent' => '', 'tab_root' => $path, 'path' => $path, - 'file' => '', - 'file path' => '', - 'include file' => '', ); - // Calculate out the file to be included for each callback, if any. - if ($item['file']) { - $file_path = $item['file path'] ? $item['file path'] : drupal_get_path('module', $item['module']); - $item['include file'] = $file_path .'/'. $item['file']; - } - $title_arguments = $item['title arguments'] ? serialize($item['title arguments']) : ''; db_query("INSERT INTO {menu_router} (path, load_functions, to_arg_functions, access_callback, access_arguments, page_callback, page_arguments, fit, number_parts, tab_parent, tab_root, title, title_callback, title_arguments, - type, block_callback, description, position, weight, file) + type, block_callback, description, position, weight) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', '%s', '%s', '%s', - %d, '%s', '%s', '%s', %d, '%s')", + %d, '%s', '%s', '%s', %d)", $path, $item['load_functions'], $item['to_arg_functions'], $item['access callback'], serialize($item['access arguments']), $item['page callback'], serialize($item['page arguments']), $item['_fit'], $item['_number_parts'], $item['tab_parent'], $item['tab_root'], $item['title'], $item['title callback'], $title_arguments, - $item['type'], $item['block callback'], $item['description'], $item['position'], $item['weight'], $item['include file']); + $item['type'], $item['block callback'], $item['description'], $item['position'], $item['weight']); } // Sort the masks so they are in order of descending fit, and store them. $masks = array_keys($masks); Index: includes/module.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/module.inc,v retrieving revision 1.115 diff -u -p -r1.115 module.inc --- includes/module.inc 27 Dec 2007 12:31:05 -0000 1.115 +++ includes/module.inc 1 Apr 2008 07:02:58 -0000 @@ -228,7 +228,7 @@ function _module_build_dependencies($fil */ function module_exists($module) { $list = module_list(); - return array_key_exists($module, $list); + return isset($list[$module]); } /** @@ -238,7 +238,14 @@ function module_load_install($module) { // Make sure the installation API is available include_once './includes/install.inc'; - module_load_include('install', $module); + $file = module_load_include('install', $module); + // Ensure that you can module_invoke something inside the newly-loaded + // file during install. + $module_list = module_list(); + if (!isset($module_list[$module])) { + $module_list[$module]['filename'] = $file; + module_list(TRUE, FALSE, FALSE, $module_list); + } } /** @@ -260,6 +267,7 @@ function module_load_include($type, $mod if (is_file($file)) { require_once $file; + return $file; } else { return FALSE; @@ -308,7 +316,7 @@ function module_enable($module_list) { // We check for the existence of node_access_needs_rebuild() since // at install time, module_enable() could be called while node.module // is not enabled yet. - if (function_exists('node_access_needs_rebuild') && !node_access_needs_rebuild() && module_hook($module, 'node_grants')) { + if (registry_check_function('node_access_needs_rebuild') && !node_access_needs_rebuild() && module_hook($module, 'node_grants')) { node_access_needs_rebuild(TRUE); } } @@ -383,7 +391,8 @@ function module_disable($module_list) { * implemented in that module. */ function module_hook($module, $hook) { - return function_exists($module .'_'. $hook); + $list = module_implements($hook); + return in_array($module, $list); } /** @@ -398,34 +407,73 @@ function module_hook($module, $hook) { * For internal use only: Whether to force the stored list of hook * implementations to be regenerated (such as after enabling a new module, * before processing hook_enable). + * @param $set_dumb + * For internal use only: use a dumb, non-registry-based version. This only finds + * implementations in modules, not in includes. * @return * An array with the names of the modules which are implementing this hook. */ -function module_implements($hook, $sort = FALSE, $refresh = FALSE) { - static $implementations; +function module_implements($hook, $sort = FALSE, $refresh = FALSE, $set_dumb = NULL) { + static $implementations, $patterns, $loaded, $dumb; + if (isset($set_dumb)) { + $dumb = $set_dumb; + } + if (defined('MAINTENANCE_MODE') || !db_is_active() || $dumb) { + $list = module_list(); + $return = array(); + foreach ($list as $module) { + $function = $module .'_'. $hook; + if (function_exists($function)) { + $return[] = $module; + } + } + return $return; + } if ($refresh) { $implementations = array(); + cache_clear_all('hooks', 'cache'); return; } - - if (!isset($implementations[$hook])) { - $implementations[$hook] = array(); - $list = module_list(FALSE, TRUE, $sort); - foreach ($list as $module) { - if (module_hook($module, $hook)) { - $implementations[$hook][] = $module; + if (empty($implementations)) { + $cache = cache_get('hooks'); + if (!$cache) { + drupal_rebuild_code_registry(); + $cache = cache_get('hooks'); + } + $implementations = $cache->data['implementations']; + $patterns = $cache->data['patterns']; + } + if (isset($implementations[$hook])) { + if (!isset($loaded[$hook])) { + $loaded[$hook] = TRUE; + foreach ($implementations[$hook] as $module) { + registry_check_function($module .'_'. $hook); } } + return (array)$implementations[$hook]; } - - // The explicit cast forces a copy to be made. This is needed because - // $implementations[$hook] is only a reference to an element of - // $implementations and if there are nested foreaches (due to nested node - // API calls, for example), they would both manipulate the same array's - // references, which causes some modules' hooks not to be called. - // See also http://www.zend.com/zend/art/ref-count.php. - return (array)$implementations[$hook]; + // We do not store empty arrays for every instance of dynamic hooks like + // hook_{$form_id}_form_alter. The actual implementations of dynamic + // hooks are cached by drupal_rebuild_code_registry so those are already + // returned. If the hook matches a pattern here, then we know that there is + // no implementation. + foreach ($patterns as $pattern) { + if (preg_match($pattern, $hook)) { + return array(); + } + } + // Other hooks are fetched from the registry and cached. + $implementations[$hook] = array(); + $result = db_query("SELECT module, name, file FROM {registry} WHERE hook = '%s' AND type = 'function'", $hook); + while ($entry = db_fetch_array($result)) { + if (!function_exists($entry['name'])) { + require_once($entry['file']); + } + $implementations[$hook][] = $entry['module']; + } + cache_set('hooks', array('patterns' => $patterns, 'implementations' => $implementations)); + return $implementations[$hook]; } /** Index: includes/theme.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.inc,v retrieving revision 1.418 diff -u -p -r1.418 theme.inc --- includes/theme.inc 25 Mar 2008 14:10:01 -0000 1.418 +++ includes/theme.inc 1 Apr 2008 07:02:59 -0000 @@ -628,7 +628,7 @@ function theme() { // call_user_func_array. $args = array(&$variables, $hook); foreach ($info['preprocess functions'] as $preprocess_function) { - if (function_exists($preprocess_function)) { + if (registry_check_function($preprocess_function)) { call_user_func_array($preprocess_function, $args); } } Index: includes/xmlrpcs.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/xmlrpcs.inc,v retrieving revision 1.24 diff -u -p -r1.24 xmlrpcs.inc --- includes/xmlrpcs.inc 31 Dec 2007 08:54:36 -0000 1.24 +++ includes/xmlrpcs.inc 1 Apr 2008 07:02:59 -0000 @@ -202,7 +202,7 @@ function xmlrpc_server_call($xmlrpc_serv } } - if (!function_exists($method)) { + if (!registry_check_function($method)) { return xmlrpc_error(-32601, t('Server error. Requested function %method does not exist.', array("%method" => $method))); } // Call the mapped function Index: modules/aggregator/aggregator.module =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.module,v retrieving revision 1.375 diff -u -p -r1.375 aggregator.module --- modules/aggregator/aggregator.module 20 Feb 2008 13:46:37 -0000 1.375 +++ modules/aggregator/aggregator.module 1 Apr 2008 07:03:00 -0000 @@ -84,7 +84,6 @@ function aggregator_menu() { 'description' => "Configure which content your site aggregates from other sites, how often it polls them, and how they're categorized.", 'page callback' => 'aggregator_admin_overview', 'access arguments' => array('administer news feeds'), - 'file' => 'aggregator.admin.inc', ); $items['admin/content/aggregator/add/feed'] = array( 'title' => 'Add feed', @@ -93,7 +92,6 @@ function aggregator_menu() { 'access arguments' => array('administer news feeds'), 'type' => MENU_LOCAL_TASK, 'parent' => 'admin/content/aggregator', - 'file' => 'aggregator.admin.inc', ); $items['admin/content/aggregator/add/category'] = array( 'title' => 'Add category', @@ -102,7 +100,6 @@ function aggregator_menu() { 'access arguments' => array('administer news feeds'), 'type' => MENU_LOCAL_TASK, 'parent' => 'admin/content/aggregator', - 'file' => 'aggregator.admin.inc', ); $items['admin/content/aggregator/remove/%aggregator_feed'] = array( 'title' => 'Remove items', @@ -110,7 +107,6 @@ function aggregator_menu() { 'page arguments' => array('aggregator_admin_remove_feed', 4), 'access arguments' => array('administer news feeds'), 'type' => MENU_CALLBACK, - 'file' => 'aggregator.admin.inc', ); $items['admin/content/aggregator/update/%aggregator_feed'] = array( 'title' => 'Update items', @@ -118,7 +114,6 @@ function aggregator_menu() { 'page arguments' => array(4), 'access arguments' => array('administer news feeds'), 'type' => MENU_CALLBACK, - 'file' => 'aggregator.admin.inc', ); $items['admin/content/aggregator/list'] = array( 'title' => 'List', @@ -132,40 +127,34 @@ function aggregator_menu() { 'type' => MENU_LOCAL_TASK, 'weight' => 10, 'access arguments' => array('administer news feeds'), - 'file' => 'aggregator.admin.inc', ); $items['aggregator'] = array( 'title' => 'Feed aggregator', 'page callback' => 'aggregator_page_last', 'access arguments' => array('access news feeds'), 'weight' => 5, - 'file' => 'aggregator.pages.inc', ); $items['aggregator/sources'] = array( 'title' => 'Sources', 'page callback' => 'aggregator_page_sources', 'access arguments' => array('access news feeds'), - 'file' => 'aggregator.pages.inc', ); $items['aggregator/categories'] = array( 'title' => 'Categories', 'page callback' => 'aggregator_page_categories', 'access callback' => '_aggregator_has_categories', - 'file' => 'aggregator.pages.inc', ); $items['aggregator/rss'] = array( 'title' => 'RSS feed', 'page callback' => 'aggregator_page_rss', 'access arguments' => array('access news feeds'), 'type' => MENU_CALLBACK, - 'file' => 'aggregator.pages.inc', ); $items['aggregator/opml'] = array( 'title' => 'OPML feed', 'page callback' => 'aggregator_page_opml', 'access arguments' => array('access news feeds'), 'type' => MENU_CALLBACK, - 'file' => 'aggregator.pages.inc', ); $items['aggregator/categories/%aggregator_category'] = array( 'title callback' => '_aggregator_category_title', @@ -174,7 +163,6 @@ function aggregator_menu() { 'page arguments' => array(2), 'access callback' => 'user_access', 'access arguments' => array('access news feeds'), - 'file' => 'aggregator.pages.inc', ); $items['aggregator/categories/%aggregator_category/view'] = array( 'title' => 'View', @@ -187,7 +175,6 @@ function aggregator_menu() { 'page arguments' => array('aggregator_page_category', 2), 'access arguments' => array('administer news feeds'), 'type' => MENU_LOCAL_TASK, - 'file' => 'aggregator.pages.inc', ); $items['aggregator/categories/%aggregator_category/configure'] = array( 'title' => 'Configure', @@ -196,13 +183,11 @@ function aggregator_menu() { 'access arguments' => array('administer news feeds'), 'type' => MENU_LOCAL_TASK, 'weight' => 1, - 'file' => 'aggregator.admin.inc', ); $items['aggregator/sources/%aggregator_feed'] = array( 'page callback' => 'aggregator_page_source', 'page arguments' => array(2), 'type' => MENU_CALLBACK, - 'file' => 'aggregator.pages.inc', ); $items['aggregator/sources/%aggregator_feed/view'] = array( 'title' => 'View', @@ -215,7 +200,6 @@ function aggregator_menu() { 'page arguments' => array('aggregator_page_source', 2), 'access arguments' => array('administer news feeds'), 'type' => MENU_LOCAL_TASK, - 'file' => 'aggregator.pages.inc', ); $items['aggregator/sources/%aggregator_feed/configure'] = array( 'title' => 'Configure', @@ -224,7 +208,6 @@ function aggregator_menu() { 'access arguments' => array('administer news feeds'), 'type' => MENU_LOCAL_TASK, 'weight' => 1, - 'file' => 'aggregator.admin.inc', ); $items['admin/content/aggregator/edit/feed/%aggregator_feed'] = array( 'title' => 'Edit feed', @@ -232,7 +215,6 @@ function aggregator_menu() { 'page arguments' => array('aggregator_form_feed', 5), 'access arguments' => array('administer news feeds'), 'type' => MENU_CALLBACK, - 'file' => 'aggregator.admin.inc', ); $items['admin/content/aggregator/edit/category/%aggregator_category'] = array( 'title' => 'Edit category', @@ -240,7 +222,6 @@ function aggregator_menu() { 'page arguments' => array('aggregator_form_category', 5), 'access arguments' => array('administer news feeds'), 'type' => MENU_CALLBACK, - 'file' => 'aggregator.admin.inc', ); return $items; Index: modules/block/block.module =================================================================== RCS file: /cvs/drupal/drupal/modules/block/block.module,v retrieving revision 1.301 diff -u -p -r1.301 block.module --- modules/block/block.module 21 Mar 2008 08:41:25 -0000 1.301 +++ modules/block/block.module 1 Apr 2008 07:03:01 -0000 @@ -125,7 +125,6 @@ function block_menu() { 'description' => 'Configure what block content appears in your site\'s sidebars and other regions.', 'page callback' => 'block_admin_display', 'access arguments' => array('administer blocks'), - 'file' => 'block.admin.inc', ); $items['admin/build/block/list'] = array( 'title' => 'List', @@ -136,28 +135,24 @@ function block_menu() { 'title' => 'JavaScript List Form', 'page callback' => 'block_admin_display_js', 'type' => MENU_CALLBACK, - 'file' => 'block.admin.inc', ); $items['admin/build/block/configure'] = array( 'title' => 'Configure block', 'page callback' => 'drupal_get_form', 'page arguments' => array('block_admin_configure'), 'type' => MENU_CALLBACK, - 'file' => 'block.admin.inc', ); $items['admin/build/block/delete'] = array( 'title' => 'Delete block', 'page callback' => 'drupal_get_form', 'page arguments' => array('block_box_delete'), 'type' => MENU_CALLBACK, - 'file' => 'block.admin.inc', ); $items['admin/build/block/add'] = array( 'title' => 'Add block', 'page callback' => 'drupal_get_form', 'page arguments' => array('block_add_block_form'), 'type' => MENU_LOCAL_TASK, - 'file' => 'block.admin.inc', ); $default = variable_get('theme_default', 'garland'); foreach (list_themes() as $key => $theme) { @@ -166,7 +161,6 @@ function block_menu() { 'page arguments' => array($key), 'type' => $key == $default ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK, 'weight' => $key == $default ? -10 : 0, - 'file' => 'block.admin.inc', 'access callback' => '_block_themes_access', 'access arguments' => array($theme), ); Index: modules/blog/blog.module =================================================================== RCS file: /cvs/drupal/drupal/modules/blog/blog.module,v retrieving revision 1.299 diff -u -p -r1.299 blog.module --- modules/blog/blog.module 20 Feb 2008 13:46:38 -0000 1.299 +++ modules/blog/blog.module 1 Apr 2008 07:03:01 -0000 @@ -138,7 +138,6 @@ function blog_menu() { 'page callback' => 'blog_page_last', 'access arguments' => array('access content'), 'type' => MENU_SUGGESTED_ITEM, - 'file' => 'blog.pages.inc', ); $items['blog/%user_current'] = array( 'title' => 'My blog', @@ -146,7 +145,6 @@ function blog_menu() { 'page arguments' => array(1), 'access callback' => 'user_access', 'access arguments' => array('create blog content', 1), - 'file' => 'blog.pages.inc', ); $items['blog/%user/feed'] = array( 'title' => 'Blogs', @@ -154,14 +152,12 @@ function blog_menu() { 'page arguments' => array(1), 'access arguments' => array('access content'), 'type' => MENU_CALLBACK, - 'file' => 'blog.pages.inc', ); $items['blog/feed'] = array( 'title' => 'Blogs', 'page callback' => 'blog_feed_last', 'access arguments' => array('access content'), 'type' => MENU_CALLBACK, - 'file' => 'blog.pages.inc', ); return $items; Index: modules/book/book.module =================================================================== RCS file: /cvs/drupal/drupal/modules/book/book.module,v retrieving revision 1.458 diff -u -p -r1.458 book.module --- modules/book/book.module 14 Mar 2008 08:51:37 -0000 1.458 +++ modules/book/book.module 1 Apr 2008 07:03:02 -0000 @@ -85,7 +85,6 @@ function book_menu() { 'description' => "Manage your site's book outlines.", 'page callback' => 'book_admin_overview', 'access arguments' => array('administer book outlines'), - 'file' => 'book.admin.inc', ); $items['admin/content/book/list'] = array( 'title' => 'List', @@ -98,7 +97,6 @@ function book_menu() { 'access arguments' => array('administer site configuration'), 'type' => MENU_LOCAL_TASK, 'weight' => 8, - 'file' => 'book.admin.inc', ); $items['admin/content/book/%node'] = array( 'title' => 'Re-order book pages and change titles', @@ -107,21 +105,18 @@ function book_menu() { 'access callback' => '_book_outline_access', 'access arguments' => array(3), 'type' => MENU_CALLBACK, - 'file' => 'book.admin.inc', ); $items['book'] = array( 'title' => 'Books', 'page callback' => 'book_render', 'access arguments' => array('access content'), 'type' => MENU_SUGGESTED_ITEM, - 'file' => 'book.pages.inc', ); $items['book/export/%/%'] = array( 'page callback' => 'book_export', 'page arguments' => array(2, 3), 'access arguments' => array('access printer-friendly version'), 'type' => MENU_CALLBACK, - 'file' => 'book.pages.inc', ); $items['node/%node/outline'] = array( 'title' => 'Outline', @@ -131,7 +126,6 @@ function book_menu() { 'access arguments' => array(1), 'type' => MENU_LOCAL_TASK, 'weight' => 2, - 'file' => 'book.pages.inc', ); $items['node/%node/outline/remove'] = array( 'title' => 'Remove from outline', @@ -140,13 +134,11 @@ function book_menu() { 'access callback' => '_book_outline_remove_access', 'access arguments' => array(1), 'type' => MENU_CALLBACK, - 'file' => 'book.pages.inc', ); $items['book/js/form'] = array( 'page callback' => 'book_form_update', 'access arguments' => array('access content'), 'type' => MENU_CALLBACK, - 'file' => 'book.pages.inc', ); return $items; } Index: modules/comment/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v retrieving revision 1.621 diff -u -p -r1.621 comment.module --- modules/comment/comment.module 23 Feb 2008 08:02:48 -0000 1.621 +++ modules/comment/comment.module 1 Apr 2008 07:03:04 -0000 @@ -199,7 +199,6 @@ function comment_menu() { 'description' => 'List and edit site comments and the comment moderation queue.', 'page callback' => 'comment_admin', 'access arguments' => array('administer comments'), - 'file' => 'comment.admin.inc', ); // Tabs: @@ -212,7 +211,6 @@ function comment_menu() { 'title' => 'Approval queue', 'page arguments' => array('approval'), 'type' => MENU_LOCAL_TASK, - 'file' => 'comment.admin.inc', ); $items['comment/delete'] = array( @@ -220,7 +218,6 @@ function comment_menu() { 'page callback' => 'comment_delete', 'access arguments' => array('administer comments'), 'type' => MENU_CALLBACK, - 'file' => 'comment.admin.inc', ); $items['comment/edit'] = array( @@ -228,7 +225,6 @@ function comment_menu() { 'page callback' => 'comment_edit', 'access arguments' => array('post comments'), 'type' => MENU_CALLBACK, - 'file' => 'comment.pages.inc', ); $items['comment/reply/%node'] = array( 'title' => 'Reply to comment', @@ -237,7 +233,6 @@ function comment_menu() { 'access callback' => 'node_access', 'access arguments' => array('view', 2), 'type' => MENU_CALLBACK, - 'file' => 'comment.pages.inc', ); return $items; Index: modules/contact/contact.module =================================================================== RCS file: /cvs/drupal/drupal/modules/contact/contact.module,v retrieving revision 1.104 diff -u -p -r1.104 contact.module --- modules/contact/contact.module 20 Feb 2008 13:46:39 -0000 1.104 +++ modules/contact/contact.module 1 Apr 2008 07:03:04 -0000 @@ -51,13 +51,11 @@ function contact_menu() { 'description' => 'Create a system contact form and set up categories for the form to use.', 'page callback' => 'contact_admin_categories', 'access arguments' => array('administer site-wide contact form'), - 'file' => 'contact.admin.inc', ); $items['admin/build/contact/list'] = array( 'title' => 'List', 'page callback' => 'contact_admin_categories', 'type' => MENU_DEFAULT_LOCAL_TASK, - 'file' => 'contact.admin.inc', ); $items['admin/build/contact/add'] = array( 'title' => 'Add category', @@ -65,21 +63,18 @@ function contact_menu() { 'page arguments' => array('contact_admin_edit', 3), 'type' => MENU_LOCAL_TASK, 'weight' => 1, - 'file' => 'contact.admin.inc', ); $items['admin/build/contact/edit/%contact'] = array( 'title' => 'Edit contact category', 'page callback' => 'drupal_get_form', 'page arguments' => array('contact_admin_edit', 3, 4), 'type' => MENU_CALLBACK, - 'file' => 'contact.admin.inc', ); $items['admin/build/contact/delete/%contact'] = array( 'title' => 'Delete contact', 'page callback' => 'drupal_get_form', 'page arguments' => array('contact_admin_delete', 4), 'type' => MENU_CALLBACK, - 'file' => 'contact.admin.inc', ); $items['admin/build/contact/settings'] = array( 'title' => 'Settings', @@ -87,14 +82,12 @@ function contact_menu() { 'page arguments' => array('contact_admin_settings'), 'type' => MENU_LOCAL_TASK, 'weight' => 2, - 'file' => 'contact.admin.inc', ); $items['contact'] = array( 'title' => 'Contact', 'page callback' => 'contact_site_page', 'access arguments' => array('access site-wide contact form'), 'type' => MENU_SUGGESTED_ITEM, - 'file' => 'contact.pages.inc', ); $items['user/%user/contact'] = array( 'title' => 'Contact', @@ -104,7 +97,6 @@ function contact_menu() { 'access callback' => '_contact_user_tab_access', 'access arguments' => array(1), 'weight' => 2, - 'file' => 'contact.pages.inc', ); return $items; } Index: modules/dblog/dblog.module =================================================================== RCS file: /cvs/drupal/drupal/modules/dblog/dblog.module,v retrieving revision 1.21 diff -u -p -r1.21 dblog.module --- modules/dblog/dblog.module 8 Jan 2008 10:35:41 -0000 1.21 +++ modules/dblog/dblog.module 1 Apr 2008 07:03:04 -0000 @@ -47,7 +47,6 @@ function dblog_menu() { 'description' => 'Settings for logging to the Drupal database logs. This is the most common method for small to medium sites on shared hosting. The logs are viewable from the admin pages.', 'page callback' => 'drupal_get_form', 'page arguments' => array('dblog_admin_settings'), - 'file' => 'dblog.admin.inc', ); $items['admin/reports/dblog'] = array( @@ -55,28 +54,24 @@ function dblog_menu() { 'description' => 'View events that have recently been logged.', 'page callback' => 'dblog_overview', 'weight' => -1, - 'file' => 'dblog.admin.inc', ); $items['admin/reports/page-not-found'] = array( 'title' => "Top 'page not found' errors", 'description' => "View 'page not found' errors (404s).", 'page callback' => 'dblog_top', 'page arguments' => array('page not found'), - 'file' => 'dblog.admin.inc', ); $items['admin/reports/access-denied'] = array( 'title' => "Top 'access denied' errors", 'description' => "View 'access denied' errors (403s).", 'page callback' => 'dblog_top', 'page arguments' => array('access denied'), - 'file' => 'dblog.admin.inc', ); $items['admin/reports/event/%'] = array( 'title' => 'Details', 'page callback' => 'dblog_event', 'page arguments' => array(3), 'type' => MENU_CALLBACK, - 'file' => 'dblog.admin.inc', ); return $items; } Index: modules/filter/filter.module =================================================================== RCS file: /cvs/drupal/drupal/modules/filter/filter.module,v retrieving revision 1.207 diff -u -p -r1.207 filter.module --- modules/filter/filter.module 13 Mar 2008 21:26:08 -0000 1.207 +++ modules/filter/filter.module 1 Apr 2008 07:03:05 -0000 @@ -73,7 +73,6 @@ function filter_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('filter_admin_overview'), 'access arguments' => array('administer filters'), - 'file' => 'filter.admin.inc', ); $items['admin/settings/filters/list'] = array( 'title' => 'List', @@ -84,21 +83,18 @@ function filter_menu() { 'page callback' => 'filter_admin_format_page', 'type' => MENU_LOCAL_TASK, 'weight' => 1, - 'file' => 'filter.admin.inc', ); $items['admin/settings/filters/delete'] = array( 'title' => 'Delete input format', 'page callback' => 'drupal_get_form', 'page arguments' => array('filter_admin_delete'), 'type' => MENU_CALLBACK, - 'file' => 'filter.admin.inc', ); $items['filter/tips'] = array( 'title' => 'Compose tips', 'page callback' => 'filter_tips_long', 'access callback' => TRUE, 'type' => MENU_SUGGESTED_ITEM, - 'file' => 'filter.pages.inc', ); $items['admin/settings/filters/%filter_format'] = array( 'type' => MENU_CALLBACK, @@ -107,14 +103,12 @@ function filter_menu() { 'page callback' => 'filter_admin_format_page', 'page arguments' => array(3), 'access arguments' => array('administer filters'), - 'file' => 'filter.admin.inc', ); $items['admin/settings/filters/%filter_format/edit'] = array( 'title' => 'Edit', 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => 0, - 'file' => 'filter.admin.inc', ); $items['admin/settings/filters/%filter_format/configure'] = array( 'title' => 'Configure', @@ -122,7 +116,6 @@ function filter_menu() { 'page arguments' => array(3), 'type' => MENU_LOCAL_TASK, 'weight' => 1, - 'file' => 'filter.admin.inc', ); $items['admin/settings/filters/%filter_format/order'] = array( 'title' => 'Rearrange', @@ -130,7 +123,6 @@ function filter_menu() { 'page arguments' => array(3), 'type' => MENU_LOCAL_TASK, 'weight' => 2, - 'file' => 'filter.admin.inc', ); return $items; } Index: modules/forum/forum.module =================================================================== RCS file: /cvs/drupal/drupal/modules/forum/forum.module,v retrieving revision 1.452 diff -u -p -r1.452 forum.module --- modules/forum/forum.module 20 Feb 2008 13:46:39 -0000 1.452 +++ modules/forum/forum.module 1 Apr 2008 07:03:06 -0000 @@ -87,7 +87,6 @@ function forum_menu() { 'page callback' => 'forum_page', 'access arguments' => array('access content'), 'type' => MENU_SUGGESTED_ITEM, - 'file' => 'forum.pages.inc', ); $items['admin/content/forum'] = array( 'title' => 'Forums', @@ -95,7 +94,6 @@ function forum_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('forum_overview'), 'access arguments' => array('administer forums'), - 'file' => 'forum.admin.inc', ); $items['admin/content/forum/list'] = array( 'title' => 'List', @@ -108,7 +106,6 @@ function forum_menu() { 'page arguments' => array('container'), 'type' => MENU_LOCAL_TASK, 'parent' => 'admin/content/forum', - 'file' => 'forum.admin.inc', ); $items['admin/content/forum/add/forum'] = array( 'title' => 'Add forum', @@ -116,7 +113,6 @@ function forum_menu() { 'page arguments' => array('forum'), 'type' => MENU_LOCAL_TASK, 'parent' => 'admin/content/forum', - 'file' => 'forum.admin.inc', ); $items['admin/content/forum/settings'] = array( 'title' => 'Settings', @@ -125,26 +121,22 @@ function forum_menu() { 'weight' => 5, 'type' => MENU_LOCAL_TASK, 'parent' => 'admin/content/forum', - 'file' => 'forum.admin.inc', ); $items['admin/content/forum/edit/%forum_term'] = array( 'page callback' => 'forum_form_main', 'type' => MENU_CALLBACK, - 'file' => 'forum.admin.inc', ); $items['admin/content/forum/edit/container/%forum_term'] = array( 'title' => 'Edit container', 'page callback' => 'forum_form_main', 'page arguments' => array('container', 5), 'type' => MENU_CALLBACK, - 'file' => 'forum.admin.inc', ); $items['admin/content/forum/edit/forum/%forum_term'] = array( 'title' => 'Edit forum', 'page callback' => 'forum_form_main', 'page arguments' => array('forum', 5), 'type' => MENU_CALLBACK, - 'file' => 'forum.admin.inc', ); return $items; } Index: modules/help/help.module =================================================================== RCS file: /cvs/drupal/drupal/modules/help/help.module,v retrieving revision 1.78 diff -u -p -r1.78 help.module --- modules/help/help.module 14 Dec 2007 18:08:46 -0000 1.78 +++ modules/help/help.module 1 Apr 2008 07:03:06 -0000 @@ -15,7 +15,6 @@ function help_menu() { 'page callback' => 'help_main', 'access arguments' => array('access administration pages'), 'weight' => 9, - 'file' => 'help.admin.inc', ); foreach (module_implements('help', TRUE) as $module) { @@ -24,7 +23,6 @@ function help_menu() { 'page callback' => 'help_page', 'page arguments' => array(2), 'type' => MENU_CALLBACK, - 'file' => 'help.admin.inc', ); } Index: modules/menu/menu.module =================================================================== RCS file: /cvs/drupal/drupal/modules/menu/menu.module,v retrieving revision 1.159 diff -u -p -r1.159 menu.module --- modules/menu/menu.module 20 Feb 2008 13:46:40 -0000 1.159 +++ modules/menu/menu.module 1 Apr 2008 07:03:06 -0000 @@ -52,21 +52,18 @@ function menu_menu() { 'page callback' => 'menu_overview_page', 'access callback' => 'user_access', 'access arguments' => array('administer menu'), - 'file' => 'menu.admin.inc', ); $items['admin/build/menu/list'] = array( 'title' => 'List menus', 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10, - 'file' => 'menu.admin.inc', ); $items['admin/build/menu/add'] = array( 'title' => 'Add menu', 'page callback' => 'drupal_get_form', 'page arguments' => array('menu_edit_menu', 'add'), 'type' => MENU_LOCAL_TASK, - 'file' => 'menu.admin.inc', ); $items['admin/build/menu/settings'] = array( 'title' => 'Settings', @@ -74,7 +71,6 @@ function menu_menu() { 'page arguments' => array('menu_configure'), 'type' => MENU_LOCAL_TASK, 'weight' => 5, - 'file' => 'menu.admin.inc', ); $items['admin/build/menu-customize/%menu'] = array( 'title' => 'Customize menu', @@ -84,55 +80,47 @@ function menu_menu() { 'title arguments' => array(3), 'access arguments' => array('administer menu'), 'type' => MENU_CALLBACK, - 'file' => 'menu.admin.inc', ); $items['admin/build/menu-customize/%menu/list'] = array( 'title' => 'List items', 'weight' => -10, 'type' => MENU_DEFAULT_LOCAL_TASK, - 'file' => 'menu.admin.inc', ); $items['admin/build/menu-customize/%menu/add'] = array( 'title' => 'Add item', 'page callback' => 'drupal_get_form', 'page arguments' => array('menu_edit_item', 'add', NULL, 3), 'type' => MENU_LOCAL_TASK, - 'file' => 'menu.admin.inc', ); $items['admin/build/menu-customize/%menu/edit'] = array( 'title' => 'Edit menu', 'page callback' => 'drupal_get_form', 'page arguments' => array('menu_edit_menu', 'edit', 3), 'type' => MENU_LOCAL_TASK, - 'file' => 'menu.admin.inc', ); $items['admin/build/menu-customize/%menu/delete'] = array( 'title' => 'Delete menu', 'page callback' => 'menu_delete_menu_page', 'page arguments' => array(3), 'type' => MENU_CALLBACK, - 'file' => 'menu.admin.inc', ); $items['admin/build/menu/item/%menu_link/edit'] = array( 'title' => 'Edit menu item', 'page callback' => 'drupal_get_form', 'page arguments' => array('menu_edit_item', 'edit', 4, NULL), 'type' => MENU_CALLBACK, - 'file' => 'menu.admin.inc', ); $items['admin/build/menu/item/%menu_link/reset'] = array( 'title' => 'Reset menu item', 'page callback' => 'drupal_get_form', 'page arguments' => array('menu_reset_item_confirm', 4), 'type' => MENU_CALLBACK, - 'file' => 'menu.admin.inc', ); $items['admin/build/menu/item/%menu_link/delete'] = array( 'title' => 'Delete menu item', 'page callback' => 'menu_item_delete_page', 'page arguments' => array(4), 'type' => MENU_CALLBACK, - 'file' => 'menu.admin.inc', ); return $items; Index: modules/node/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.module,v retrieving revision 1.952 diff -u -p -r1.952 node.module --- modules/node/node.module 27 Mar 2008 07:32:00 -0000 1.952 +++ modules/node/node.module 1 Apr 2008 07:03:08 -0000 @@ -1406,7 +1406,6 @@ function node_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('node_admin_content'), 'access arguments' => array('administer nodes'), - 'file' => 'node.admin.inc', ); $items['admin/content/node/overview'] = array( @@ -1421,12 +1420,10 @@ function node_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('node_configure'), 'access arguments' => array('administer nodes'), - 'file' => 'node.admin.inc', ); $items['admin/content/node-settings/rebuild'] = array( 'title' => 'Rebuild permissions', 'page arguments' => array('node_configure_rebuild_confirm'), - 'file' => 'node.admin.inc', // Any user than can potentially trigger a node_acess_needs_rebuild(TRUE) // has to be allowed access to the 'node access rebuild' confirm form. 'access arguments' => array('access administration pages'), @@ -1438,7 +1435,6 @@ function node_menu() { 'description' => 'Manage posts by content type, including default status, front page promotion, etc.', 'page callback' => 'node_overview_types', 'access arguments' => array('administer content types'), - 'file' => 'content_types.inc', ); $items['admin/content/types/list'] = array( 'title' => 'List', @@ -1449,7 +1445,6 @@ function node_menu() { 'title' => 'Add content type', 'page callback' => 'drupal_get_form', 'page arguments' => array('node_type_form'), - 'file' => 'content_types.inc', 'type' => MENU_LOCAL_TASK, ); $items['node'] = array( @@ -1463,7 +1458,6 @@ function node_menu() { 'page callback' => 'node_add_page', 'access callback' => '_node_add_access', 'weight' => 1, - 'file' => 'node.pages.inc', ); $items['rss.xml'] = array( 'title' => 'RSS feed', @@ -1481,13 +1475,11 @@ function node_menu() { 'access callback' => 'node_access', 'access arguments' => array('create', $type->type), 'description' => $type->description, - 'file' => 'node.pages.inc', ); $items['admin/content/node-type/'. $type_url_str] = array( 'title' => $type->name, 'page callback' => 'drupal_get_form', 'page arguments' => array('node_type_form', $type), - 'file' => 'content_types.inc', 'type' => MENU_CALLBACK, ); $items['admin/content/node-type/'. $type_url_str .'/edit'] = array( @@ -1497,7 +1489,6 @@ function node_menu() { $items['admin/content/node-type/'. $type_url_str .'/delete'] = array( 'title' => 'Delete', 'page arguments' => array('node_type_delete_confirm', $type), - 'file' => 'content_types.inc', 'type' => MENU_CALLBACK, ); } @@ -1520,7 +1511,6 @@ function node_menu() { 'access callback' => 'node_access', 'access arguments' => array('update', 1), 'weight' => 1, - 'file' => 'node.pages.inc', 'type' => MENU_LOCAL_TASK, ); $items['node/%node/delete'] = array( @@ -1529,7 +1519,6 @@ function node_menu() { 'page arguments' => array('node_delete_confirm', 1), 'access callback' => 'node_access', 'access arguments' => array('delete', 1), - 'file' => 'node.pages.inc', 'weight' => 1, 'type' => MENU_CALLBACK); $items['node/%node/revisions'] = array( @@ -1539,7 +1528,6 @@ function node_menu() { 'access callback' => '_node_revision_access', 'access arguments' => array(1), 'weight' => 2, - 'file' => 'node.pages.inc', 'type' => MENU_LOCAL_TASK, ); $items['node/%node/revisions/%/view'] = array( @@ -1556,7 +1544,6 @@ function node_menu() { 'page arguments' => array('node_revision_revert_confirm', 1), 'access callback' => '_node_revision_access', 'access arguments' => array(1, 'update'), - 'file' => 'node.pages.inc', 'type' => MENU_CALLBACK, ); $items['node/%node/revisions/%/delete'] = array( @@ -1566,7 +1553,6 @@ function node_menu() { 'page arguments' => array('node_revision_delete_confirm', 1), 'access callback' => '_node_revision_access', 'access arguments' => array(1, 'delete'), - 'file' => 'node.pages.inc', 'type' => MENU_CALLBACK, ); return $items; Index: modules/openid/openid.module =================================================================== RCS file: /cvs/drupal/drupal/modules/openid/openid.module,v retrieving revision 1.21 diff -u -p -r1.21 openid.module --- modules/openid/openid.module 18 Feb 2008 19:34:08 -0000 1.21 +++ modules/openid/openid.module 1 Apr 2008 07:03:09 -0000 @@ -15,7 +15,6 @@ function openid_menu() { 'page callback' => 'openid_authentication_page', 'access callback' => 'user_is_anonymous', 'type' => MENU_CALLBACK, - 'file' => 'openid.pages.inc', ); $items['user/%user/openid'] = array( 'title' => 'OpenID identities', @@ -24,14 +23,12 @@ function openid_menu() { 'access callback' => 'user_edit_access', 'access arguments' => array(1), 'type' => MENU_LOCAL_TASK, - 'file' => 'openid.pages.inc', ); $items['user/%user/openid/delete'] = array( 'title' => 'Delete OpenID', 'page callback' => 'openid_user_delete', 'page arguments' => array(1), 'type' => MENU_CALLBACK, - 'file' => 'openid.pages.inc', ); return $items; } Index: modules/path/path.module =================================================================== RCS file: /cvs/drupal/drupal/modules/path/path.module,v retrieving revision 1.140 diff -u -p -r1.140 path.module --- modules/path/path.module 13 Mar 2008 21:26:09 -0000 1.140 +++ modules/path/path.module 1 Apr 2008 07:03:09 -0000 @@ -38,20 +38,17 @@ function path_menu() { 'description' => "Change your site's URL paths by aliasing them.", 'page callback' => 'path_admin_overview', 'access arguments' => array('administer url aliases'), - 'file' => 'path.admin.inc', ); $items['admin/build/path/edit'] = array( 'title' => 'Edit alias', 'page callback' => 'path_admin_edit', 'type' => MENU_CALLBACK, - 'file' => 'path.admin.inc', ); $items['admin/build/path/delete'] = array( 'title' => 'Delete alias', 'page callback' => 'drupal_get_form', 'page arguments' => array('path_admin_delete_confirm'), 'type' => MENU_CALLBACK, - 'file' => 'path.admin.inc', ); $items['admin/build/path/list'] = array( 'title' => 'List', @@ -63,7 +60,6 @@ function path_menu() { 'page callback' => 'path_admin_edit', 'access arguments' => array('administer url aliases'), 'type' => MENU_LOCAL_TASK, - 'file' => 'path.admin.inc', ); return $items; Index: modules/poll/poll.module =================================================================== RCS file: /cvs/drupal/drupal/modules/poll/poll.module,v retrieving revision 1.264 diff -u -p -r1.264 poll.module --- modules/poll/poll.module 20 Feb 2008 13:46:40 -0000 1.264 +++ modules/poll/poll.module 1 Apr 2008 07:03:09 -0000 @@ -87,7 +87,6 @@ function poll_menu() { 'page callback' => 'poll_page', 'access arguments' => array('access content'), 'type' => MENU_SUGGESTED_ITEM, - 'file' => 'poll.pages.inc', ); $items['node/%node/votes'] = array( @@ -98,7 +97,6 @@ function poll_menu() { 'access arguments' => array(1, 'inspect all votes', FALSE), 'weight' => 3, 'type' => MENU_LOCAL_TASK, - 'file' => 'poll.pages.inc', ); $items['node/%node/results'] = array( @@ -109,7 +107,6 @@ function poll_menu() { 'access arguments' => array(1, 'access content', TRUE), 'weight' => 3, 'type' => MENU_LOCAL_TASK, - 'file' => 'poll.pages.inc', ); $items['poll/js'] = array( Index: modules/profile/profile.module =================================================================== RCS file: /cvs/drupal/drupal/modules/profile/profile.module,v retrieving revision 1.236 diff -u -p -r1.236 profile.module --- modules/profile/profile.module 3 Feb 2008 19:36:46 -0000 1.236 +++ modules/profile/profile.module 1 Apr 2008 07:03:10 -0000 @@ -81,7 +81,6 @@ function profile_menu() { 'page callback' => 'profile_browse', 'access arguments' => array('access user profiles'), 'type' => MENU_SUGGESTED_ITEM, - 'file' => 'profile.pages.inc', ); $items['admin/user/profile'] = array( 'title' => 'Profiles', @@ -89,41 +88,35 @@ function profile_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('profile_admin_overview'), 'access arguments' => array('administer users'), - 'file' => 'profile.admin.inc', ); $items['admin/user/profile/add'] = array( 'title' => 'Add field', 'page callback' => 'drupal_get_form', 'page arguments' => array('profile_field_form'), 'type' => MENU_CALLBACK, - 'file' => 'profile.admin.inc', ); $items['admin/user/profile/autocomplete'] = array( 'title' => 'Profile category autocomplete', 'page callback' => 'profile_admin_settings_autocomplete', 'type' => MENU_CALLBACK, - 'file' => 'profile.admin.inc', ); $items['admin/user/profile/edit'] = array( 'title' => 'Edit field', 'page callback' => 'drupal_get_form', 'page arguments' => array('profile_field_form'), 'type' => MENU_CALLBACK, - 'file' => 'profile.admin.inc', ); $items['admin/user/profile/delete'] = array( 'title' => 'Delete field', 'page callback' => 'drupal_get_form', 'page arguments' => array('profile_field_delete'), 'type' => MENU_CALLBACK, - 'file' => 'profile.admin.inc', ); $items['profile/autocomplete'] = array( 'title' => 'Profile autocomplete', 'page callback' => 'profile_autocomplete', 'access arguments' => array('access user profiles'), 'type' => MENU_CALLBACK, - 'file' => 'profile.pages.inc', ); return $items; } Index: modules/search/search.module =================================================================== RCS file: /cvs/drupal/drupal/modules/search/search.module,v retrieving revision 1.251 diff -u -p -r1.251 search.module --- modules/search/search.module 20 Feb 2008 13:46:40 -0000 1.251 +++ modules/search/search.module 1 Apr 2008 07:03:11 -0000 @@ -174,7 +174,6 @@ function search_menu() { 'page callback' => 'search_view', 'access arguments' => array('search content'), 'type' => MENU_SUGGESTED_ITEM, - 'file' => 'search.pages.inc', ); $items['admin/settings/search'] = array( 'title' => 'Search settings', @@ -183,7 +182,6 @@ function search_menu() { 'page arguments' => array('search_admin_settings'), 'access arguments' => array('administer search'), 'type' => MENU_NORMAL_ITEM, - 'file' => 'search.admin.inc', ); $items['admin/settings/search/wipe'] = array( 'title' => 'Clear index', @@ -191,14 +189,12 @@ function search_menu() { 'page arguments' => array('search_wipe_confirm'), 'access arguments' => array('administer search'), 'type' => MENU_CALLBACK, - 'file' => 'search.admin.inc', ); $items['admin/reports/search'] = array( 'title' => 'Top search phrases', 'description' => 'View most popular search phrases.', 'page callback' => 'dblog_top', 'page arguments' => array('search'), - 'file' => 'dblog.admin.inc', 'file path' => drupal_get_path('module', 'dblog'), ); @@ -212,7 +208,6 @@ function search_menu() { 'access arguments' => array($name), 'type' => MENU_LOCAL_TASK, 'parent' => 'search', - 'file' => 'search.pages.inc', ); } return $items; Index: modules/statistics/statistics.module =================================================================== RCS file: /cvs/drupal/drupal/modules/statistics/statistics.module,v retrieving revision 1.273 diff -u -p -r1.273 statistics.module --- modules/statistics/statistics.module 20 Feb 2008 13:46:40 -0000 1.273 +++ modules/statistics/statistics.module 1 Apr 2008 07:03:11 -0000 @@ -101,7 +101,6 @@ function statistics_menu() { 'description' => 'View pages that have recently been visited.', 'page callback' => 'statistics_recent_hits', 'access arguments' => array('access statistics'), - 'file' => 'statistics.admin.inc', ); $items['admin/reports/pages'] = array( 'title' => 'Top pages', @@ -109,7 +108,6 @@ function statistics_menu() { 'page callback' => 'statistics_top_pages', 'access arguments' => array('access statistics'), 'weight' => 1, - 'file' => 'statistics.admin.inc', ); $items['admin/reports/visitors'] = array( 'title' => 'Top visitors', @@ -117,14 +115,12 @@ function statistics_menu() { 'page callback' => 'statistics_top_visitors', 'access arguments' => array('access statistics'), 'weight' => 2, - 'file' => 'statistics.admin.inc', ); $items['admin/reports/referrers'] = array( 'title' => 'Top referrers', 'description' => 'View top referrers.', 'page callback' => 'statistics_top_referrers', 'access arguments' => array('access statistics'), - 'file' => 'statistics.admin.inc', ); $items['admin/reports/access/%'] = array( 'title' => 'Details', @@ -133,7 +129,6 @@ function statistics_menu() { 'page arguments' => array(3), 'access arguments' => array('access statistics'), 'type' => MENU_CALLBACK, - 'file' => 'statistics.admin.inc', ); $items['admin/reports/settings'] = array( 'title' => 'Access log settings', @@ -143,7 +138,6 @@ function statistics_menu() { 'access arguments' => array('administer site configuration'), 'type' => MENU_NORMAL_ITEM, 'weight' => 3, - 'file' => 'statistics.admin.inc', ); $items['user/%user/track/navigation'] = array( 'title' => 'Track page visits', @@ -152,7 +146,6 @@ function statistics_menu() { 'access arguments' => array('access statistics'), 'type' => MENU_LOCAL_TASK, 'weight' => 2, - 'file' => 'statistics.pages.inc', ); $items['node/%node/track'] = array( 'title' => 'Track', @@ -161,7 +154,6 @@ function statistics_menu() { 'access arguments' => array('access statistics'), 'type' => MENU_LOCAL_TASK, 'weight' => 2, - 'file' => 'statistics.pages.inc', ); return $items; Index: modules/system/system.install =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.install,v retrieving revision 1.244 diff -u -p -r1.244 system.install --- modules/system/system.install 21 Mar 2008 08:52:25 -0000 1.244 +++ modules/system/system.install 1 Apr 2008 07:03:13 -0000 @@ -580,6 +580,8 @@ function system_schema() { $schema['cache_page']['description'] = t('Cache table used to store compressed pages for anonymous users, if page caching is enabled.'); $schema['cache_menu'] = $schema['cache']; $schema['cache_menu']['description'] = t('Cache table for the menu system to store router information as well as generated link trees for various menu/page/user combinations.'); + $schema['cache_registry'] = $schema['cache']; + $schema['cache_registry']['description'] = t('Cache table for the code registry system to remember what code files need to be loaded on any given page.'); $schema['files'] = array( 'description' => t('Stores information for uploaded files.'), @@ -836,11 +838,6 @@ function system_schema() { 'not null' => TRUE, 'default' => 0, ), - 'file' => array( - 'description' => t('The file to include for this element, usually the page callback function lives in this file.'), - 'type' => 'text', - 'size' => 'medium', - ), ), 'indexes' => array( 'fit' => array('fit'), @@ -1033,6 +1030,49 @@ function system_schema() { 'primary key' => array('mlid'), ); + $schema['registry'] = array( + 'description' => t("Each record is a function, class, or interface name and the file it is in."), + 'fields' => array( + 'name' => array( + 'description' => t('The name of the function, class, or interface.'), + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + ), + 'type' => array( + 'description' => t('Either function or class or interface.'), + 'type' => 'varchar', + 'length' => 9, + 'not null' => TRUE, + 'default' => '', + ), + 'module' => array( + 'description' => t('Name of the module this file belongs to.'), + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + ), + 'hook' => array( + 'description' => t('Name of the function minus the name of the module.'), + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + ), + 'file' => array( + 'description' => t('Path to the file.'), + 'type' => 'text', + 'size' => 'medium', + ), + ), + 'primary key' => array('name', 'type'), + 'indexes' => array( + 'module_implements' => array('type', 'hook'), + ), + ); + $schema['sessions'] = array( 'description' => t("Drupal's session handlers read and write into the sessions table. Each record represents a user session, either anonymous or authenticated."), 'fields' => array( @@ -2659,7 +2699,7 @@ function system_update_7000() { } /** - * Generate a cron key and save it in the variables table + * Generate a cron key and save it in the variables table. */ function system_update_7001() { $ret = array(); @@ -2668,6 +2708,44 @@ function system_update_7001() { return $ret; } +/** + * Registry tables and drop the file key of the menu router, since it is no + * longer needed. + */ +function system_update_7002() { + $ret = array(); + db_drop_field($ret, 'menu_router', 'file'); + $schema['registry'] = array( + 'fields' => array( + 'name' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), + 'type' => array('type' => 'varchar', 'length' => 9, 'not null' => TRUE, 'default' => ''), + 'module' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), + 'hook' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), + 'file' => array('type' => 'varchar', 'length' => 64, 'not null' => TRUE, 'default' => ''), + ), + 'primary key' => array('name', 'type'), + 'indexes' => array( + 'module_implements' => array('type', 'hook'), + ), + ); + $schema['cache_registry'] = array( + 'fields' => array( + 'cid' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), + 'data' => array('type' => 'blob', 'not null' => FALSE, 'size' => 'big'), + 'expire' => array('type' => 'int', 'not null' => TRUE, 'default' => 0), + 'created' => array('type' => 'int', 'not null' => TRUE, 'default' => 0), + 'headers' => array('type' => 'text', 'not null' => FALSE), + 'serialized' => array('type' => 'int', 'size' => 'small', 'not null' => TRUE, 'default' => 0) + ), + 'indexes' => array('expire' => array('expire')), + 'primary key' => array('cid'), + ); + db_create_table($ret, 'cache_registry', $schema['cache_registry']); + db_create_table($ret, 'registry', $schema['registry']); + drupal_rebuild_code_registry(); + return $return; +} + /** * @} End of "defgroup updates-6.x-to-7.x" Index: modules/system/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.module,v retrieving revision 1.593 diff -u -p -r1.593 system.module --- modules/system/system.module 11 Mar 2008 08:13:14 -0000 1.593 +++ modules/system/system.module 1 Apr 2008 07:03:15 -0000 @@ -215,24 +215,20 @@ function system_menu() { 'access arguments' => array('access administration pages'), 'page callback' => 'system_main_admin_page', 'weight' => 9, - 'file' => 'system.admin.inc', ); $items['admin/compact'] = array( 'title' => 'Compact mode', 'page callback' => 'system_admin_compact_page', 'type' => MENU_CALLBACK, - 'file' => 'system.admin.inc', ); $items['admin/by-task'] = array( 'title' => 'By task', 'page callback' => 'system_main_admin_page', - 'file' => 'system.admin.inc', 'type' => MENU_DEFAULT_LOCAL_TASK, ); $items['admin/by-module'] = array( 'title' => 'By module', 'page callback' => 'system_admin_by_module', - 'file' => 'system.admin.inc', 'type' => MENU_LOCAL_TASK, 'weight' => 2, ); @@ -242,7 +238,6 @@ function system_menu() { 'position' => 'left', 'weight' => -10, 'page callback' => 'system_admin_menu_block_page', - 'file' => 'system.admin.inc', ); // menu items that are basically just menu blocks @@ -252,7 +247,6 @@ function system_menu() { 'position' => 'right', 'weight' => -5, 'page callback' => 'system_settings_overview', - 'file' => 'system.admin.inc', ); $items['admin/build'] = array( 'title' => 'Site building', @@ -260,7 +254,6 @@ function system_menu() { 'position' => 'right', 'weight' => -10, 'page callback' => 'system_admin_menu_block_page', - 'file' => 'system.admin.inc', ); $items['admin/settings/admin'] = array( 'title' => 'Administration theme', @@ -270,7 +263,6 @@ function system_menu() { 'page arguments' => array('system_admin_theme_settings'), 'access arguments' => array('administer site configuration'), 'block callback' => 'system_admin_theme_settings', - 'file' => 'system.admin.inc', ); // Themes: $items['admin/build/themes'] = array( @@ -279,7 +271,6 @@ function system_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('system_themes_form', NULL), 'access arguments' => array('administer site configuration'), - 'file' => 'system.admin.inc', ); $items['admin/build/themes/select'] = array( 'title' => 'List', @@ -316,7 +307,6 @@ function system_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('system_modules'), 'access arguments' => array('administer site configuration'), - 'file' => 'system.admin.inc', ); $items['admin/build/modules/list'] = array( 'title' => 'List', @@ -376,7 +366,6 @@ function system_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('system_site_information_settings'), 'access arguments' => array('administer site configuration'), - 'file' => 'system.admin.inc', ); $items['admin/settings/error-reporting'] = array( 'title' => 'Error reporting', @@ -384,14 +373,12 @@ function system_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('system_error_reporting_settings'), 'access arguments' => array('administer site configuration'), - 'file' => 'system.admin.inc', ); $items['admin/settings/logging'] = array( 'title' => 'Logging and alerts', 'description' => "Settings for logging and alerts modules. Various modules can route Drupal's system events to different destination, such as syslog, database, email, ...etc.", 'page callback' => 'system_logging_overview', 'access arguments' => array('administer site configuration'), - 'file' => 'system.admin.inc', ); $items['admin/settings/performance'] = array( 'title' => 'Performance', @@ -399,7 +386,6 @@ function system_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('system_performance_settings'), 'access arguments' => array('administer site configuration'), - 'file' => 'system.admin.inc', ); $items['admin/settings/file-system'] = array( 'title' => 'File system', @@ -407,7 +393,6 @@ function system_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('system_file_system_settings'), 'access arguments' => array('administer site configuration'), - 'file' => 'system.admin.inc', ); $items['admin/settings/image-toolkit'] = array( 'title' => 'Image toolkit', @@ -415,7 +400,6 @@ function system_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('system_image_toolkit_settings'), 'access arguments' => array('administer site configuration'), - 'file' => 'system.admin.inc', ); $items['admin/content/rss-publishing'] = array( 'title' => 'RSS publishing', @@ -423,7 +407,6 @@ function system_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('system_rss_feeds_settings'), 'access arguments' => array('administer site configuration'), - 'file' => 'system.admin.inc', ); $items['admin/settings/date-time'] = array( 'title' => 'Date and time', @@ -431,13 +414,11 @@ function system_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('system_date_time_settings'), 'access arguments' => array('administer site configuration'), - 'file' => 'system.admin.inc', ); $items['admin/settings/date-time/lookup'] = array( 'title' => 'Date and time lookup', 'type' => MENU_CALLBACK, 'page callback' => 'system_date_time_lookup', - 'file' => 'system.admin.inc', ); $items['admin/settings/site-maintenance'] = array( 'title' => 'Site maintenance', @@ -445,7 +426,6 @@ function system_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('system_site_maintenance_settings'), 'access arguments' => array('administer site configuration'), - 'file' => 'system.admin.inc', ); $items['admin/settings/clean-urls'] = array( 'title' => 'Clean URLs', @@ -453,7 +433,6 @@ function system_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('system_clean_url_settings'), 'access arguments' => array('administer site configuration'), - 'file' => 'system.admin.inc', ); $items['admin/settings/clean-urls/check'] = array( 'title' => 'Clean URL check', @@ -480,7 +459,6 @@ function system_menu() { 'access arguments' => array('access site reports'), 'weight' => 5, 'position' => 'left', - 'file' => 'system.admin.inc', ); $items['admin/reports/status'] = array( 'title' => 'Status report', @@ -488,32 +466,27 @@ function system_menu() { 'page callback' => 'system_status', 'weight' => 10, 'access arguments' => array('administer site configuration'), - 'file' => 'system.admin.inc', ); $items['admin/reports/status/run-cron'] = array( 'title' => 'Run cron', 'page callback' => 'system_run_cron', 'type' => MENU_CALLBACK, - 'file' => 'system.admin.inc', ); $items['admin/reports/status/php'] = array( 'title' => 'PHP', 'page callback' => 'system_php', 'type' => MENU_CALLBACK, - 'file' => 'system.admin.inc', ); $items['admin/reports/status/sql'] = array( 'title' => 'SQL', 'page callback' => 'system_sql', 'type' => MENU_CALLBACK, - 'file' => 'system.admin.inc', ); // Default page for batch operations $items['batch'] = array( 'page callback' => 'system_batch_page', 'access callback' => TRUE, 'type' => MENU_CALLBACK, - 'file' => 'system.admin.inc', ); return $items; } @@ -1305,6 +1278,13 @@ function system_action_info() { } /** + * Implementation of hook_hooks(). + */ +function system_hooks() { + return array('form__alter'); +} + +/** * Menu callback. Display an overview of available and configured actions. */ function system_actions_manage() { Index: modules/taxonomy/taxonomy.module =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.module,v retrieving revision 1.417 diff -u -p -r1.417 taxonomy.module --- modules/taxonomy/taxonomy.module 2 Mar 2008 05:58:40 -0000 1.417 +++ modules/taxonomy/taxonomy.module 1 Apr 2008 07:03:16 -0000 @@ -117,7 +117,6 @@ function taxonomy_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('taxonomy_overview_vocabularies'), 'access arguments' => array('administer taxonomy'), - 'file' => 'taxonomy.admin.inc', ); $items['admin/content/taxonomy/list'] = array( @@ -132,7 +131,6 @@ function taxonomy_menu() { 'page arguments' => array('taxonomy_form_vocabulary'), 'type' => MENU_LOCAL_TASK, 'parent' => 'admin/content/taxonomy', - 'file' => 'taxonomy.admin.inc', ); $items['admin/content/taxonomy/edit/vocabulary/%taxonomy_vocabulary'] = array( @@ -140,14 +138,12 @@ function taxonomy_menu() { 'page callback' => 'taxonomy_admin_vocabulary_edit', 'page arguments' => array(5), 'type' => MENU_CALLBACK, - 'file' => 'taxonomy.admin.inc', ); $items['admin/content/taxonomy/edit/term'] = array( 'title' => 'Edit term', 'page callback' => 'taxonomy_admin_term_edit', 'type' => MENU_CALLBACK, - 'file' => 'taxonomy.admin.inc', ); $items['taxonomy/term/%'] = array( @@ -156,7 +152,6 @@ function taxonomy_menu() { 'page arguments' => array(2), 'access arguments' => array('access content'), 'type' => MENU_CALLBACK, - 'file' => 'taxonomy.pages.inc', ); $items['taxonomy/autocomplete'] = array( @@ -164,7 +159,6 @@ function taxonomy_menu() { 'page callback' => 'taxonomy_autocomplete', 'access arguments' => array('access content'), 'type' => MENU_CALLBACK, - 'file' => 'taxonomy.pages.inc', ); $items['admin/content/taxonomy/%taxonomy_vocabulary'] = array( 'title' => 'List terms', @@ -172,7 +166,6 @@ function taxonomy_menu() { 'page arguments' => array('taxonomy_overview_terms', 3), 'access arguments' => array('administer taxonomy'), 'type' => MENU_CALLBACK, - 'file' => 'taxonomy.admin.inc', ); $items['admin/content/taxonomy/%taxonomy_vocabulary/list'] = array( @@ -187,7 +180,6 @@ function taxonomy_menu() { 'page arguments' => array(3), 'type' => MENU_LOCAL_TASK, 'parent' => 'admin/content/taxonomy/%taxonomy_vocabulary', - 'file' => 'taxonomy.admin.inc', ); return $items; Index: modules/throttle/throttle.module =================================================================== RCS file: /cvs/drupal/drupal/modules/throttle/throttle.module,v retrieving revision 1.83 diff -u -p -r1.83 throttle.module --- modules/throttle/throttle.module 14 Dec 2007 18:08:49 -0000 1.83 +++ modules/throttle/throttle.module 1 Apr 2008 07:03:16 -0000 @@ -13,7 +13,6 @@ function throttle_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('throttle_admin_settings'), 'access arguments' => array('administer site configuration'), - 'file' => 'throttle.admin.inc', ); return $items; } Index: modules/tracker/tracker.module =================================================================== RCS file: /cvs/drupal/drupal/modules/tracker/tracker.module,v retrieving revision 1.154 diff -u -p -r1.154 tracker.module --- modules/tracker/tracker.module 14 Dec 2007 18:08:49 -0000 1.154 +++ modules/tracker/tracker.module 1 Apr 2008 07:03:16 -0000 @@ -28,7 +28,6 @@ function tracker_menu() { 'page callback' => 'tracker_page', 'access arguments' => array('access content'), 'weight' => 1, - 'file' => 'tracker.pages.inc', ); $items['tracker/all'] = array( 'title' => 'All recent posts', @@ -47,7 +46,6 @@ function tracker_menu() { 'page callback' => 'tracker_page', 'page arguments' => array(1, TRUE), 'type' => MENU_LOCAL_TASK, - 'file' => 'tracker.pages.inc', ); $items['user/%user/track/posts'] = array( 'title' => 'Track posts', Index: modules/translation/translation.module =================================================================== RCS file: /cvs/drupal/drupal/modules/translation/translation.module,v retrieving revision 1.24 diff -u -p -r1.24 translation.module --- modules/translation/translation.module 20 Feb 2008 13:46:42 -0000 1.24 +++ modules/translation/translation.module 1 Apr 2008 07:03:16 -0000 @@ -63,7 +63,6 @@ function translation_menu() { 'access arguments' => array(1), 'type' => MENU_LOCAL_TASK, 'weight' => 2, - 'file' => 'translation.pages.inc', ); return $items; } Index: modules/trigger/trigger.module =================================================================== RCS file: /cvs/drupal/drupal/modules/trigger/trigger.module,v retrieving revision 1.14 diff -u -p -r1.14 trigger.module --- modules/trigger/trigger.module 17 Feb 2008 22:15:04 -0000 1.14 +++ modules/trigger/trigger.module 1 Apr 2008 07:03:17 -0000 @@ -41,7 +41,6 @@ function trigger_menu() { 'page callback' => 'trigger_assign', 'access callback' => 'trigger_access_check', 'access arguments' => array('node'), - 'file' => 'trigger.admin.inc', ); // We don't use a menu wildcard here because these are tabs, // not invisible items. @@ -51,7 +50,6 @@ function trigger_menu() { 'page arguments' => array('node'), 'access arguments' => array('node'), 'type' => MENU_LOCAL_TASK, - 'file' => 'trigger.admin.inc', ); $items['admin/build/trigger/user'] = array( 'title' => 'Users', @@ -59,7 +57,6 @@ function trigger_menu() { 'page arguments' => array('user'), 'access arguments' => array('user'), 'type' => MENU_LOCAL_TASK, - 'file' => 'trigger.admin.inc', ); $items['admin/build/trigger/comment'] = array( 'title' => 'Comments', @@ -68,7 +65,6 @@ function trigger_menu() { 'access callback' => 'trigger_access_check', 'access arguments' => array('comment'), 'type' => MENU_LOCAL_TASK, - 'file' => 'trigger.admin.inc', ); $items['admin/build/trigger/taxonomy'] = array( 'title' => 'Taxonomy', @@ -77,14 +73,12 @@ function trigger_menu() { 'access callback' => 'trigger_access_check', 'access arguments' => array('taxonomy'), 'type' => MENU_LOCAL_TASK, - 'file' => 'trigger.admin.inc', ); $items['admin/build/trigger/cron'] = array( 'title' => 'Cron', 'page callback' => 'trigger_assign', 'page arguments' => array('cron'), 'type' => MENU_LOCAL_TASK, - 'file' => 'trigger.admin.inc', ); // We want contributed modules to be able to describe @@ -104,7 +98,6 @@ function trigger_menu() { 'page arguments' => array($module), 'access arguments' => array($module), 'type' => MENU_LOCAL_TASK, - 'file' => 'trigger.admin.inc', ); } $items['admin/build/trigger/unassign'] = array( @@ -113,7 +106,6 @@ function trigger_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('trigger_unassign'), 'type' => MENU_CALLBACK, - 'file' => 'trigger.admin.inc', ); return $items; Index: modules/update/update.module =================================================================== RCS file: /cvs/drupal/drupal/modules/update/update.module,v retrieving revision 1.17 diff -u -p -r1.17 update.module --- modules/update/update.module 30 Jan 2008 10:14:42 -0000 1.17 +++ modules/update/update.module 1 Apr 2008 07:03:17 -0000 @@ -121,14 +121,12 @@ function update_menu() { 'description' => 'Get a status report about available updates for your installed modules and themes.', 'page callback' => 'update_status', 'access arguments' => array('administer site configuration'), - 'file' => 'update.report.inc', 'weight' => 10, ); $items['admin/reports/updates/list'] = array( 'title' => 'List', 'page callback' => 'update_status', 'access arguments' => array('administer site configuration'), - 'file' => 'update.report.inc', 'type' => MENU_DEFAULT_LOCAL_TASK, ); $items['admin/reports/updates/settings'] = array( @@ -136,14 +134,12 @@ function update_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('update_settings'), 'access arguments' => array('administer site configuration'), - 'file' => 'update.settings.inc', 'type' => MENU_LOCAL_TASK, ); $items['admin/reports/updates/check'] = array( 'title' => 'Manual update check', 'page callback' => 'update_manual_status', 'access arguments' => array('administer site configuration'), - 'file' => 'update.fetch.inc', 'type' => MENU_CALLBACK, ); Index: modules/upload/upload.module =================================================================== RCS file: /cvs/drupal/drupal/modules/upload/upload.module,v retrieving revision 1.199 diff -u -p -r1.199 upload.module --- modules/upload/upload.module 20 Feb 2008 13:46:42 -0000 1.199 +++ modules/upload/upload.module 1 Apr 2008 07:03:18 -0000 @@ -92,7 +92,6 @@ function upload_menu() { 'page arguments' => array('upload_admin_settings'), 'access arguments' => array('administer site configuration'), 'type' => MENU_NORMAL_ITEM, - 'file' => 'upload.admin.inc', ); return $items; } Index: modules/user/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.module,v retrieving revision 1.898 diff -u -p -r1.898 user.module --- modules/user/user.module 31 Mar 2008 20:50:05 -0000 1.898 +++ modules/user/user.module 1 Apr 2008 07:03:20 -0000 @@ -847,7 +847,6 @@ function user_menu() { 'access callback' => 'user_access', 'access arguments' => array('access user profiles'), 'type' => MENU_CALLBACK, - 'file' => 'user.pages.inc', ); // Registration and login pages. @@ -856,7 +855,6 @@ function user_menu() { 'page callback' => 'user_page', 'access callback' => TRUE, 'type' => MENU_CALLBACK, - 'file' => 'user.pages.inc', ); $items['user/login'] = array( @@ -871,7 +869,6 @@ function user_menu() { 'page arguments' => array('user_register'), 'access callback' => 'user_register_access', 'type' => MENU_LOCAL_TASK, - 'file' => 'user.pages.inc', ); $items['user/password'] = array( @@ -880,7 +877,6 @@ function user_menu() { 'page arguments' => array('user_pass'), 'access callback' => 'user_is_anonymous', 'type' => MENU_LOCAL_TASK, - 'file' => 'user.pages.inc', ); $items['user/reset/%/%/%'] = array( 'title' => 'Reset password', @@ -888,7 +884,6 @@ function user_menu() { 'page arguments' => array('user_pass_reset', 2, 3, 4), 'access callback' => TRUE, 'type' => MENU_CALLBACK, - 'file' => 'user.pages.inc', ); // Admin user pages. @@ -898,8 +893,6 @@ function user_menu() { 'position' => 'left', 'page callback' => 'system_admin_menu_block_page', 'access arguments' => array('access administration pages'), - 'file' => 'system.admin.inc', - 'file path' => drupal_get_path('module', 'system'), ); $items['admin/user/user'] = array( 'title' => 'Users', @@ -907,7 +900,6 @@ function user_menu() { 'page callback' => 'user_admin', 'page arguments' => array('list'), 'access arguments' => array('administer users'), - 'file' => 'user.admin.inc', ); $items['admin/user/user/list'] = array( 'title' => 'List', @@ -918,7 +910,6 @@ function user_menu() { 'title' => 'Add user', 'page arguments' => array('create'), 'type' => MENU_LOCAL_TASK, - 'file' => 'user.admin.inc', ); $items['admin/user/settings'] = array( 'title' => 'User settings', @@ -926,7 +917,6 @@ function user_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('user_admin_settings'), 'access arguments' => array('administer users'), - 'file' => 'user.admin.inc', ); // Admin access pages. @@ -936,7 +926,6 @@ function user_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('user_admin_perm'), 'access arguments' => array('administer permissions'), - 'file' => 'user.admin.inc', ); $items['admin/user/roles'] = array( 'title' => 'Roles', @@ -944,20 +933,17 @@ function user_menu() { 'page callback' => 'drupal_get_form', 'page arguments' => array('user_admin_new_role'), 'access arguments' => array('administer permissions'), - 'file' => 'user.admin.inc', ); $items['admin/user/roles/edit'] = array( 'title' => 'Edit role', 'page arguments' => array('user_admin_role'), 'type' => MENU_CALLBACK, - 'file' => 'user.admin.inc', ); $items['admin/user/rules'] = array( 'title' => 'Access rules', 'description' => 'List and create rules to disallow usernames, e-mail addresses, and IP addresses.', 'page callback' => 'user_admin_access', 'access arguments' => array('administer permissions'), - 'file' => 'user.admin.inc', ); $items['admin/user/rules/list'] = array( 'title' => 'List', @@ -968,26 +954,22 @@ function user_menu() { 'title' => 'Add rule', 'page callback' => 'user_admin_access_add', 'type' => MENU_LOCAL_TASK, - 'file' => 'user.admin.inc', ); $items['admin/user/rules/check'] = array( 'title' => 'Check rules', 'page callback' => 'user_admin_access_check', 'type' => MENU_LOCAL_TASK, - 'file' => 'user.admin.inc', ); $items['admin/user/rules/edit'] = array( 'title' => 'Edit rule', 'page callback' => 'user_admin_access_edit', 'type' => MENU_CALLBACK, - 'file' => 'user.admin.inc', ); $items['admin/user/rules/delete'] = array( 'title' => 'Delete rule', 'page callback' => 'drupal_get_form', 'page arguments' => array('user_admin_access_delete_confirm'), 'type' => MENU_CALLBACK, - 'file' => 'user.admin.inc', ); $items['logout'] = array( @@ -995,7 +977,6 @@ function user_menu() { 'access callback' => 'user_is_logged_in', 'page callback' => 'user_logout', 'weight' => 10, - 'file' => 'user.pages.inc', ); $items['user/%user_current'] = array( @@ -1007,7 +988,6 @@ function user_menu() { 'access callback' => 'user_view_access', 'access arguments' => array(1), 'parent' => '', - 'file' => 'user.pages.inc', ); $items['user/%user/view'] = array( @@ -1023,7 +1003,6 @@ function user_menu() { 'access callback' => 'user_access', 'access arguments' => array('administer users'), 'type' => MENU_CALLBACK, - 'file' => 'user.pages.inc', ); $items['user/%user_category/edit'] = array( @@ -1034,7 +1013,6 @@ function user_menu() { 'access arguments' => array(1), 'type' => MENU_LOCAL_TASK, 'load arguments' => array('%map', '%index'), - 'file' => 'user.pages.inc', ); $items['user/%user_category/edit/account'] = array( @@ -1059,7 +1037,6 @@ function user_menu() { 'weight' => $category['weight'], 'load arguments' => array('%map', '%index'), 'tab_parent' => 'user/%/edit', - 'file' => 'user.pages.inc', ); } }