Index: includes/install.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/install.inc,v
retrieving revision 1.96
diff -u -p -r1.96 install.inc
--- includes/install.inc	15 Jul 2009 02:08:41 -0000	1.96
+++ includes/install.inc	17 Jul 2009 09:23:25 -0000
@@ -92,24 +92,24 @@ function drupal_load_updates() {
  *   Otherwise, FALSE.
  */
 function drupal_get_schema_versions($module) {
-  $updates = array();
-  $functions = get_defined_functions();
-  foreach ($functions['user'] as $function) {
-    if (strpos($function, $module . '_update_') === 0) {
-      $version = substr($function, strlen($module . '_update_'));
+  $updates = &drupal_static(__FUNCTION__, array());
+  if (!($updates)) {
+    $result = db_query("SELECT name, module FROM registry WHERE name LIKE ('%%_update_%%')");
+    foreach ($result as $record) {
+      $version = substr($record->name, strlen($record->module . '_update_'));
       if (is_numeric($version)) {
-        $updates[] = $version;
+        $updates[$record->module][] = $version;
+        // Make sure updates are run in numeric order.
+        sort($updates[$record->module], SORT_NUMERIC);
       }
     }
   }
-  if (count($updates) == 0) {
+
+  if (empty($updates[$module])) {
     return FALSE;
   }
 
-  // Make sure updates are run in numeric order, not in definition order.
-  sort($updates, SORT_NUMERIC);
-
-  return $updates;
+  return $updates[$module];
 }
 
 /**
