Index: includes/module.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/module.inc,v
retrieving revision 1.198
diff -u -p -r1.198 module.inc
--- includes/module.inc	3 Sep 2010 19:49:55 -0000	1.198
+++ includes/module.inc	1 Oct 2010 06:33:02 -0000
@@ -405,8 +405,19 @@ function module_enable($module_list, $en
       // Now install the module if necessary.
       if (drupal_get_installed_schema_version($module, TRUE) == SCHEMA_UNINSTALLED) {
         drupal_install_schema($module);
+
+        // Set the schema version to the number of the last update provided
+        // by the module.
         $versions = drupal_get_schema_versions($module);
-        drupal_set_installed_schema_version($module, $versions ? max($versions) : SCHEMA_INSTALLED);
+        $version = $versions ? max($versions) : SCHEMA_INSTALLED;
+
+        // If the module has no current updates, but has some that were
+        // previously removed, set the version to the value of
+        // hook_update_last_removed().
+        if ($last_removed = module_invoke($module, 'update_last_removed')) {
+          $version = max($version, $last_removed);
+        }
+        drupal_set_installed_schema_version($module, $version);
         // Allow the module to perform install tasks.
         module_invoke($module, 'install');
         // Record the fact that it was installed.
