Index: includes/bootstrap.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v
retrieving revision 1.229
diff -u -p -r1.229 bootstrap.inc
--- includes/bootstrap.inc	6 Oct 2008 14:26:54 -0000	1.229
+++ includes/bootstrap.inc	6 Oct 2008 17:44:32 -0000
@@ -1438,31 +1438,6 @@ function registry_rebuild() {
 }
 
 /**
- * Save hook implementations cache.
- *
- * @param $hook
- *   Array with the hook name and list of modules that implement it.
- * @param $write_to_persistent_cache
- *   Whether to write to the persistent cache.
- */
-function registry_cache_hook_implementations($hook, $write_to_persistent_cache = FALSE) {
-  static $implementations;
-
-  if ($hook) {
-    // Newer is always better, so overwrite anything that's come before.
-    $implementations[$hook['hook']] = $hook['modules'];
-  }
-
-  if ($write_to_persistent_cache === TRUE) {
-    // Only write this to cache if the implementations data we are going to cache
-    // is different to what we loaded earlier in the request.
-    if ($implementations != module_implements()) {
-      cache_set('hooks', $implementations, 'cache_registry');
-    }
-  }
-}
-
-/**
  * Save the files required by the registry for this path.
  */
 function registry_cache_path_files() {
Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.800
diff -u -p -r1.800 common.inc
--- includes/common.inc	6 Oct 2008 11:07:14 -0000	1.800
+++ includes/common.inc	6 Oct 2008 17:44:32 -0000
@@ -1531,7 +1531,7 @@ function drupal_page_footer() {
 
   module_invoke_all('exit');
 
-  registry_cache_hook_implementations(FALSE, TRUE);
+  module_implements(MODULE_IMPLEMENTS_WRITE_CACHE);
   registry_cache_path_files();
 }
 
@@ -2523,8 +2523,6 @@ function _drupal_bootstrap_full() {
   fix_gpc_magic();
   // Load all enabled modules
   module_load_all();
-  // Rebuild the module hook cache
-  module_implements('', NULL, TRUE);
 
   // Let all modules take action before menu system handles the request
   // We do not want this while running update.php.
Index: includes/menu.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/menu.inc,v
retrieving revision 1.292
diff -u -p -r1.292 menu.inc
--- includes/menu.inc	22 Sep 2008 03:19:43 -0000	1.292
+++ includes/menu.inc	6 Oct 2008 17:44:32 -0000
@@ -1730,7 +1730,7 @@ function menu_router_build($reset = FALS
       // We need to manually call each module so that we can know which module
       // a given item came from.
       $callbacks = array();
-      foreach (module_implements('menu', NULL, TRUE) as $module) {
+      foreach (module_implements('menu', TRUE) as $module) {
         $router_items = call_user_func($module . '_menu');
         if (isset($router_items) && is_array($router_items)) {
           foreach (array_keys($router_items) as $path) {
Index: includes/module.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/module.inc,v
retrieving revision 1.127
diff -u -p -r1.127 module.inc
--- includes/module.inc	27 Sep 2008 19:03:30 -0000	1.127
+++ includes/module.inc	6 Oct 2008 17:44:32 -0000
@@ -7,6 +7,17 @@
  */
 
 /**
+ * Pass this to module_implements when its cache needs to be written.
+ */
+define('MODULE_IMPLEMENTS_WRITE_CACHE', -1);
+
+/**
+ * Pass this to module_implements when its cache needs to be cleared.
+ */
+define('MODULE_IMPLEMENTS_CLEAR_CACHE', -2);
+
+
+/**
  * Load all the modules that have been enabled in the system table.
  */
 function module_load_all() {
@@ -381,45 +392,136 @@ function module_hook($module, $hook) {
  * Determine which modules are implementing a hook.
  *
  * @param $hook
- *   The name of the hook (e.g. "help" or "menu").
+ *   The name of the hook (e.g. "help" or "menu"). Special cases:
+ *     MODULE_IMPLEMENTS_CLEAR_CACHE: force the stored list of hook
+ *     implementations to be regenerated (such as after enabling a new module,
+ *     before processing hook_enable).
+ *     MODULE_IMPLEMENTS_WRITE_CACHE: write the stored list of hook
+ *     implementations into the cache_registry table.
  * @param $sort
  *   By default, modules are ordered by weight and filename, settings this option
  *   to TRUE, module list will be ordered by module name.
- * @param $refresh
- *   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).  Note that if $refresh is TRUE this function
- *   will always return NULL.
  * @return
  *   An array with the names of the modules which are implementing this hook.
- *   If $hook is NULL then it will return the implementation cache.
+ *   All enabled modules are taken into consideration and the files containing
+ *   the implementations are loaded as necessary.
  */
-function module_implements($hook = NULL, $sort = FALSE, $refresh = FALSE) {
-  static $implementations = array();
+function module_implements($hook, $sort = FALSE) {
+  static $implementations = array(), $loaded = array(), $cache;
 
-  if (!isset($hook)) {
-    return $implementations;
+  if (defined('MAINTENANCE_MODE')) {
+    return _module_implements_maintenance($hook);
   }
-  if ($refresh) {
+  if ($hook == MODULE_IMPLEMENTS_CLEAR_CACHE) {
     $implementations = array();
+    $loaded = array();
+    cache_clear_all('hooks', 'cache_registry');
+    return;
+  }
+  if ($hook == MODULE_IMPLEMENTS_WRITE_CACHE) {
+    // Only write this to cache if the implementations data we are going to cache
+    // is different to what we loaded earlier in the request.
+    if ($cache && $implementations != $cache->data) {
+      cache_set('hooks', $implementations, 'cache_registry');
+    }
+    return;
   }
-  if (!defined('MAINTENANCE_MODE') && empty($implementations) && ($cache = cache_get('hooks', 'cache_registry'))) {
+
+  if (empty($implementations) && ($cache = cache_get('hooks', 'cache_registry'))) {
     $implementations = $cache->data;
   }
 
-  if ($hook) {
-    if (!isset($implementations[$hook])) {
-      $implementations[$hook] = array();
-      foreach (module_list() as $module) {
-        if (module_hook($module, $hook)) {
-          $implementations[$hook][] = $module;
-        }
-      }
+  if (empty($loaded[$hook])) {
+    if (isset($implementations[$hook])) {
+      _module_implements_check($implementations, $hook);
     }
-    registry_cache_hook_implementations(array('hook' => $hook, 'modules' => $implementations[$hook]));
+    else {
+      $implementations[$hook] = _module_implements_build($hook);
+    }
+    $loaded[$hook] = TRUE;
+  }
 
-    return $implementations[$hook];
+  return $sort ? _module_implements_sorted($implementations, $hook) : $implementations[$hook];
+}
+
+/**
+ * This is the maintenance version of module_implements.
+ *
+ * @param $hook
+ *   The name of the hook (e.g. "help" or "menu").
+ * @return
+ *   An array with the names of the modules which are implementing this hook.
+ *   Only enabled and already loaded modules are taken into consideration.
+ */
+function _module_implements_maintenance($hook) {
+  $implementations = array();
+  foreach (module_list() as $module) {
+    $function = $module . '_' . $hook;
+    if (function_exists($function)) {
+      $implementations[] = $module;
+    }
+  }
+  return $implementations;
+}
+
+/**
+ * Checks whether the functions implementationing a hook are in memory.
+ *
+ * @param $implementations
+ *   The cached implementations.
+ * @param $hook
+ *   The name of the hook.
+ */
+function _module_implements_check($implementations, $hook) {
+  foreach ($implementations[$hook] as $module) {
+    $function = $module . '_' . $hook;
+    // Though drupal_function_exists itself checks function_exists,
+    // most of the time the function will exist because of the per router path
+    // hook cache so we can save lots of calls to drupal_function_exists.
+    if (!function_exists($function)) {
+      drupal_function_exists($function);
+    }
+  }
+}
+
+/**
+ * Collects the implementations of a hook from the registry table.
+ *
+ * @param $hook
+ *   The name of the hook.
+ * @return
+ *   An array with the names of the modules which are implementing this hook.
+ *   All enabled modules are taken into consideration and the files containing
+ *   the implementations are loaded as necessary.
+ */
+function _module_implements_build($hook) {
+  $return = array();
+  $result = db_query("SELECT name, filename, module FROM {registry} WHERE type = 'function' AND hook = '%s'", $hook);
+  while ($function = db_fetch_object($result)) {
+    $return[] = $function->module;
+    // We need to load the relevant file for this function.
+    drupal_function_exists($function->name);
+  }
+  return $return;
+}
+
+/**
+ * hook implementations, sorted by module name.
+ *
+ * @param $hook
+ *   The name of the hook (e.g. "help" or "menu"). Special cases:
+ * @return
+ *   A sorted array with the names of the modules which are implementing this
+ *   hook.
+ */
+function _module_implements_sorted($implementations, $hook) {
+  static $sorted = array(), $stored = array();
+  if (!isset($stored[$hook]) || $stored[$hook] != $implementations[$hook]) {
+    $stored[$hook] = $implementations[$hook];
+    $sorted[$hook] = $implementations[$hook];
+    sort($sorted[$hook]);
   }
+  return $sorted[$hook];
 }
 
 /**
Index: includes/registry.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/registry.inc,v
retrieving revision 1.5
diff -u -p -r1.5 registry.inc
--- includes/registry.inc	20 Sep 2008 20:22:23 -0000	1.5
+++ includes/registry.inc	6 Oct 2008 17:44:32 -0000
@@ -45,7 +45,7 @@ function _registry_rebuild() {
     if ($module->status) {
       $dir = dirname($module->filename);
       foreach ($module->info['files'] as $file) {
-        $files["$dir/$file"] = array();
+        $files["$dir/$file"] = array('module' => $module->name);
       }
     }
   }
@@ -67,6 +67,7 @@ function _registry_rebuild() {
   }
   _registry_parse_files($files);
 
+  module_implements(MODULE_IMPLEMENTS_CLEAR_CACHE);
   cache_clear_all('*', 'cache_registry', TRUE);
 }
 
@@ -95,7 +96,7 @@ function _registry_parse_files($files) {
     if ($new_file || $md5 != $file['md5']) {
       // We update the md5 after we've saved the files resources rather than here, so if we
       // don't make it through this rebuild, the next run will reparse the file.
-      _registry_parse_file($filename, $contents);
+      _registry_parse_file($filename, $contents, isset($file['module']) ? $file['module'] : '');
       $file['md5'] = $md5;
       db_merge('registry_file')
         ->key(array('filename' => $filename))
@@ -109,11 +110,13 @@ function _registry_parse_files($files) {
  * Parse a file and save its function and class listings.
  *
  * @param $filename
- *  Name of the file we are going to parse.
+ *   Name of the file we are going to parse.
  * @param $contents
- *  Contents of the file we are going to parse as a string.
+ *   Contents of the file we are going to parse as a string.
+ * @param $module
+ *   Name of the module (optional) this file belongs to.
  */
-function _registry_parse_file($filename, $contents) {
+function _registry_parse_file($filename, $contents, $module = '') {
   static $map = array(T_FUNCTION => 'function', T_CLASS => 'class', T_INTERFACE => 'interface');
   // Delete registry entries for this file, so we can insert the new resources.
   db_delete('registry')->condition('filename', $filename)->execute();
@@ -123,6 +126,18 @@ function _registry_parse_file($filename,
     if (is_array($token) && isset($map[$token[0]])) {
       $type = $map[$token[0]];
       if ($resource_name = _registry_get_resource_name($tokens, $type)) {
+        $hook = '';
+        if ($type == 'function' && !empty($module)) {
+          $n = strlen($module);
+          if (substr($resource_name, 0, $n) == $module) {
+            $hook = substr($resource_name, $n + 1);
+          }
+        }
+        $fields = array(
+          'filename' => $filename,
+          'module' => $module,
+          'hook' => $hook,
+        );
         // Because some systems, such as cache, currently use duplicate function
         // names in separate files an insert query cannot be used here as it
         // would cause a key constraint violation.  Instead we use a merge query.
@@ -132,7 +147,7 @@ function _registry_parse_file($filename,
         // filename instead of another.
         // TODO: Convert this back to an insert query after all duplicate
         // function names have been purged from Drupal.
-        db_merge('registry')->key(array('name' => $resource_name, 'type' => $type))->fields(array('filename' => $filename))->execute();
+        db_merge('registry')->key(array('name' => $resource_name, 'type' => $type))->fields($fields)->execute();
 
         // We skip the body because classes may contain functions.
         _registry_skip_body($tokens);
Index: modules/aggregator/aggregator.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.info,v
retrieving revision 1.7
diff -u -p -r1.7 aggregator.info
--- modules/aggregator/aggregator.info	15 May 2008 21:27:32 -0000	1.7
+++ modules/aggregator/aggregator.info	6 Oct 2008 17:44:32 -0000
@@ -8,3 +8,4 @@ core = 7.x
 files[] = aggregator.module
 files[] = aggregator.admin.inc
 files[] = aggregator.pages.inc
+files[] = aggregator.install
Index: modules/block/block.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/block/block.info,v
retrieving revision 1.7
diff -u -p -r1.7 block.info
--- modules/block/block.info	15 May 2008 21:30:02 -0000	1.7
+++ modules/block/block.info	6 Oct 2008 17:44:32 -0000
@@ -7,3 +7,4 @@ version = VERSION
 core = 7.x
 files[] = block.module
 files[] = block.admin.inc
+files[] = block.install
Index: modules/blogapi/blogapi.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/blogapi/blogapi.info,v
retrieving revision 1.7
diff -u -p -r1.7 blogapi.info
--- modules/blogapi/blogapi.info	13 May 2008 18:13:43 -0000	1.7
+++ modules/blogapi/blogapi.info	6 Oct 2008 17:44:32 -0000
@@ -6,3 +6,4 @@ package = Core - optional
 version = VERSION
 core = 7.x
 files[] = blogapi.module
+files[] = blogapi.install
Index: modules/book/book.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/book/book.info,v
retrieving revision 1.8
diff -u -p -r1.8 book.info
--- modules/book/book.info	15 May 2008 21:19:24 -0000	1.8
+++ modules/book/book.info	6 Oct 2008 17:44:32 -0000
@@ -8,3 +8,4 @@ core = 7.x
 files[] = book.module
 files[] = book.admin.inc
 files[] = book.pages.inc
+files[] = book.install
Index: modules/color/color.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/color/color.info,v
retrieving revision 1.7
diff -u -p -r1.7 color.info
--- modules/color/color.info	19 May 2008 19:36:41 -0000	1.7
+++ modules/color/color.info	6 Oct 2008 17:44:32 -0000
@@ -6,3 +6,4 @@ package = Core - optional
 version = VERSION
 core = 7.x
 files[] = color.module
+files[] = color.install
Index: modules/comment/comment.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.info,v
retrieving revision 1.7
diff -u -p -r1.7 comment.info
--- modules/comment/comment.info	14 May 2008 13:12:40 -0000	1.7
+++ modules/comment/comment.info	6 Oct 2008 17:44:32 -0000
@@ -8,3 +8,4 @@ core = 7.x
 files[] = comment.module
 files[] = comment.admin.inc
 files[] = comment.pages.inc
+files[] = comment.install
Index: modules/contact/contact.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/contact/contact.info,v
retrieving revision 1.6
diff -u -p -r1.6 contact.info
--- modules/contact/contact.info	6 May 2008 12:18:47 -0000	1.6
+++ modules/contact/contact.info	6 Oct 2008 17:44:32 -0000
@@ -7,3 +7,4 @@ core = 7.x
 files[] = contact.module
 files[] = contact.admin.inc
 files[] = contact.pages.inc
+files[] = contact.install
Index: modules/dblog/dblog.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/dblog/dblog.info,v
retrieving revision 1.4
diff -u -p -r1.4 dblog.info
--- modules/dblog/dblog.info	6 May 2008 12:18:47 -0000	1.4
+++ modules/dblog/dblog.info	6 Oct 2008 17:44:32 -0000
@@ -6,3 +6,4 @@ version = VERSION
 core = 7.x
 files[] = dblog.module
 files[] = dblog.admin.inc
+files[] = dblog.install
Index: modules/filter/filter.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.info,v
retrieving revision 1.7
diff -u -p -r1.7 filter.info
--- modules/filter/filter.info	9 Aug 2008 12:41:22 -0000	1.7
+++ modules/filter/filter.info	6 Oct 2008 17:44:32 -0000
@@ -7,3 +7,4 @@ core = 7.x
 files[] = filter.module
 files[] = filter.admin.inc
 files[] = filter.pages.inc
+files[] = filter.install
Index: modules/forum/forum.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/forum/forum.info,v
retrieving revision 1.9
diff -u -p -r1.9 forum.info
--- modules/forum/forum.info	3 Aug 2008 18:29:29 -0000	1.9
+++ modules/forum/forum.info	6 Oct 2008 17:44:32 -0000
@@ -9,3 +9,4 @@ core = 7.x
 files[] = forum.module
 files[] = forum.admin.inc
 files[] = forum.pages.inc
+files[] = forum.install
Index: modules/locale/locale.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/locale/locale.info,v
retrieving revision 1.8
diff -u -p -r1.8 locale.info
--- modules/locale/locale.info	6 May 2008 12:18:48 -0000	1.8
+++ modules/locale/locale.info	6 Oct 2008 17:44:32 -0000
@@ -5,3 +5,4 @@ package = Core - optional
 version = VERSION
 core = 7.x
 files[] = locale.module
+files[] = locale.install
Index: modules/menu/menu.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/menu/menu.info,v
retrieving revision 1.6
diff -u -p -r1.6 menu.info
--- modules/menu/menu.info	6 May 2008 12:18:48 -0000	1.6
+++ modules/menu/menu.info	6 Oct 2008 17:44:32 -0000
@@ -6,3 +6,4 @@ version = VERSION
 core = 7.x
 files[] = menu.module
 files[] = menu.admin.inc
+files[] = menu.install
Index: modules/node/node.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.info,v
retrieving revision 1.6
diff -u -p -r1.6 node.info
--- modules/node/node.info	6 May 2008 12:18:48 -0000	1.6
+++ modules/node/node.info	6 Oct 2008 17:44:32 -0000
@@ -8,3 +8,4 @@ files[] = node.module
 files[] = content_types.inc
 files[] = node.admin.inc
 files[] = node.pages.inc
+files[] = node.install
Index: modules/openid/openid.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/openid/openid.info,v
retrieving revision 1.4
diff -u -p -r1.4 openid.info
--- modules/openid/openid.info	6 May 2008 12:18:48 -0000	1.4
+++ modules/openid/openid.info	6 Oct 2008 17:44:32 -0000
@@ -8,3 +8,4 @@ files[] = openid.module
 files[] = openid.inc
 files[] = openid.pages.inc
 files[] = xrds.inc
+files[] = openid.install
Index: modules/php/php.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/php/php.info,v
retrieving revision 1.4
diff -u -p -r1.4 php.info
--- modules/php/php.info	6 May 2008 12:18:48 -0000	1.4
+++ modules/php/php.info	6 Oct 2008 17:44:32 -0000
@@ -5,3 +5,4 @@ package = Core - optional
 version = VERSION
 core = 7.x
 files[] = php.module
+files[] = php.install
Index: modules/poll/poll.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/poll/poll.info,v
retrieving revision 1.6
diff -u -p -r1.6 poll.info
--- modules/poll/poll.info	6 May 2008 12:18:49 -0000	1.6
+++ modules/poll/poll.info	6 Oct 2008 17:44:32 -0000
@@ -6,3 +6,4 @@ version = VERSION
 core = 7.x
 files[] = poll.module
 files[] = poll.pages.inc
+files[] = poll.install
Index: modules/profile/profile.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/profile/profile.info,v
retrieving revision 1.6
diff -u -p -r1.6 profile.info
--- modules/profile/profile.info	6 May 2008 12:18:49 -0000	1.6
+++ modules/profile/profile.info	6 Oct 2008 17:44:32 -0000
@@ -7,3 +7,4 @@ core = 7.x
 files[] = profile.module
 files[] = profile.admin.inc
 files[] = profile.pages.inc
+files[] = profile.install
Index: modules/search/search.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.info,v
retrieving revision 1.6
diff -u -p -r1.6 search.info
--- modules/search/search.info	6 May 2008 12:18:49 -0000	1.6
+++ modules/search/search.info	6 Oct 2008 17:44:33 -0000
@@ -7,3 +7,4 @@ core = 7.x
 files[] = search.module
 files[] = search.admin.inc
 files[] = search.pages.inc
+files[] = search.install
Index: modules/simpletest/simpletest.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/simpletest.info,v
retrieving revision 1.2
diff -u -p -r1.2 simpletest.info
--- modules/simpletest/simpletest.info	6 May 2008 12:18:50 -0000	1.2
+++ modules/simpletest/simpletest.info	6 Oct 2008 17:44:33 -0000
@@ -5,3 +5,4 @@ package = Core - optional
 version = VERSION
 core = 7.x
 files[] = simpletest.module
+files[] = simpletest.install
Index: modules/simpletest/tests/database_test.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/database_test.info,v
retrieving revision 1.1
diff -u -p -r1.1 database_test.info
--- modules/simpletest/tests/database_test.info	31 Aug 2008 11:43:41 -0000	1.1
+++ modules/simpletest/tests/database_test.info	6 Oct 2008 17:44:33 -0000
@@ -4,5 +4,6 @@ description = "Support module for Databa
 core = 7.x
 package = Testing
 files[] = database_test.module
+files[] = database_test.install
 version = VERSION
 hidden = TRUE
Index: modules/statistics/statistics.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/statistics/statistics.info,v
retrieving revision 1.6
diff -u -p -r1.6 statistics.info
--- modules/statistics/statistics.info	6 May 2008 12:18:50 -0000	1.6
+++ modules/statistics/statistics.info	6 Oct 2008 17:44:33 -0000
@@ -7,3 +7,4 @@ core = 7.x
 files[] = statistics.module
 files[] = statistics.admin.inc
 files[] = statistics.pages.inc
+files[] = statistics.install
Index: modules/system/system.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.info,v
retrieving revision 1.7
diff -u -p -r1.7 system.info
--- modules/system/system.info	8 Jul 2008 01:08:15 -0000	1.7
+++ modules/system/system.info	6 Oct 2008 17:44:33 -0000
@@ -7,3 +7,4 @@ core = 7.x
 files[] = system.module
 files[] = system.admin.inc
 files[] = image.gd.inc
+files[] = system.install
Index: modules/system/system.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.install,v
retrieving revision 1.269
diff -u -p -r1.269 system.install
--- modules/system/system.install	27 Sep 2008 20:16:17 -0000	1.269
+++ modules/system/system.install	6 Oct 2008 17:44:33 -0000
@@ -1091,6 +1091,20 @@ function system_schema() {
         'length' => 255,
         'not null' => TRUE,
       ),
+      'module' => array(
+        'description' => t('Name of the module the file belongs to.'),
+        'type' => 'varchar',
+        'length' => 255,
+        'not null' => TRUE,
+	'default' => ''
+      ),
+      'hook' => array(
+        'description' => t('Name of the hook this function implements, if any.'),
+        'type' => 'varchar',
+        'length' => 255,
+        'not null' => TRUE,
+	'default' => ''
+      ),
     ),
     'primary key' => array('name', 'type'),
   );
@@ -2927,9 +2941,11 @@ function system_update_7006() {
   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' => ''),
-      'filename'   => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
+      'name'     => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
+      'type'     => array('type' => 'varchar', 'length' => 9, 'not null' => TRUE, 'default' => ''),
+      'filename' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
+      'module'   => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
+      'hook'     => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
     ),
     'primary key' => array('name', 'type'),
   );
Index: modules/taxonomy/taxonomy.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.info,v
retrieving revision 1.6
diff -u -p -r1.6 taxonomy.info
--- modules/taxonomy/taxonomy.info	6 May 2008 12:18:51 -0000	1.6
+++ modules/taxonomy/taxonomy.info	6 Oct 2008 17:44:33 -0000
@@ -7,3 +7,4 @@ core = 7.x
 files[] = taxonomy.module
 files[] = taxonomy.admin.inc
 files[] = taxonomy.pages.inc
+files[] = taxonomy.install
Index: modules/trigger/trigger.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/trigger/trigger.info,v
retrieving revision 1.3
diff -u -p -r1.3 trigger.info
--- modules/trigger/trigger.info	6 May 2008 12:18:51 -0000	1.3
+++ modules/trigger/trigger.info	6 Oct 2008 17:44:33 -0000
@@ -6,3 +6,4 @@ version = VERSION
 core = 7.x
 files[] = trigger.module
 files[] = trigger.admin.inc
+files[] = trigger.install
Index: modules/update/update.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/update/update.info,v
retrieving revision 1.3
diff -u -p -r1.3 update.info
--- modules/update/update.info	6 May 2008 12:18:53 -0000	1.3
+++ modules/update/update.info	6 Oct 2008 17:44:33 -0000
@@ -9,3 +9,4 @@ files[] = update.compare.inc
 files[] = update.fetch.inc
 files[] = update.report.inc
 files[] = update.settings.inc
+files[] = update.install
Index: modules/upload/upload.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/upload/upload.info,v
retrieving revision 1.6
diff -u -p -r1.6 upload.info
--- modules/upload/upload.info	6 May 2008 12:18:53 -0000	1.6
+++ modules/upload/upload.info	6 Oct 2008 17:44:33 -0000
@@ -6,3 +6,4 @@ version = VERSION
 core = 7.x
 files[] = upload.module
 files[] = upload.admin.inc
+files[] = upload.install
Index: modules/user/user.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.info,v
retrieving revision 1.6
diff -u -p -r1.6 user.info
--- modules/user/user.info	6 May 2008 12:18:54 -0000	1.6
+++ modules/user/user.info	6 Oct 2008 17:44:33 -0000
@@ -7,3 +7,4 @@ core = 7.x
 files[] = user.module
 files[] = user.admin.inc
 files[] = user.pages.inc
+files[] = user.install
