? HEAD.png
? damz.patch
? damz.png
? drupal_function_exists.patch
? option1.png
? option2.png
? patch.png
? preg_grep.patch
? preg_grep.png
? preg_schema.patch
? schema_versions.patch
? system_admin_menu_block.patch
? includes/.install.inc.swp
? includes/.registry.inc.swp
? sites/default/files
? sites/default/settings.php
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 16:00:30 -0000
@@ -92,24 +92,22 @@ 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_'));
-      if (is_numeric($version)) {
-        $updates[] = $version;
+  $updates = &drupal_static(__FUNCTION__, NULL);
+  if (!isset($updates)) {
+    $updates = array();
+    $regexp = '/^(' . implode('|', module_list()) . ')_update_(\d+)$/';
+    $functions = get_defined_functions();
+    foreach (preg_grep('/_\d+$/', $functions['user']) as $function) {
+      if (preg_match($regexp, $function, $matches)) {
+        list(, $module, $number) = $matches;
+        $updates[$module][] = $number;
       }
     }
+    foreach ($updates as &$module_updates) {
+      sort($module_updates, SORT_NUMERIC);
+    }
   }
-  if (count($updates) == 0) {
-    return FALSE;
-  }
-
-  // Make sure updates are run in numeric order, not in definition order.
-  sort($updates, SORT_NUMERIC);
-
-  return $updates;
+  return isset($updates[$module]) ? $updates[$module] : FALSE;
 }
 
 /**
