=== added file 'modules/comment/comment.constants.inc'
--- modules/comment/comment.constants.inc	1970-01-01 00:00:00 +0000
+++ modules/comment/comment.constants.inc	2007-12-03 14:32:08 +0000
@@ -0,0 +1,112 @@
+<?php
+
+/**
+ * Comment is published.
+ */
+define('COMMENT_PUBLISHED', 0);
+
+/**
+ * Comment is awaiting approval.
+ */
+define('COMMENT_NOT_PUBLISHED', 1);
+
+/**
+ * Comments are displayed in a flat list - collapsed.
+ */
+define('COMMENT_MODE_FLAT_COLLAPSED', 1);
+
+/**
+ * Comments are displayed in a flat list - expanded.
+ */
+define('COMMENT_MODE_FLAT_EXPANDED', 2);
+
+/**
+ * Comments are displayed as a threaded list - collapsed.
+ */
+define('COMMENT_MODE_THREADED_COLLAPSED', 3);
+
+/**
+ * Comments are displayed as a threaded list - expanded.
+ */
+define('COMMENT_MODE_THREADED_EXPANDED', 4);
+
+/**
+ * Comments are ordered by date - newest first.
+ */
+define('COMMENT_ORDER_NEWEST_FIRST', 1);
+
+/**
+ * Comments are ordered by date - oldest first.
+ */
+define('COMMENT_ORDER_OLDEST_FIRST', 2);
+
+/**
+ * Comment controls should be shown above the comment list.
+ */
+define('COMMENT_CONTROLS_ABOVE', 0);
+
+/**
+ * Comment controls should be shown below the comment list.
+ */
+define('COMMENT_CONTROLS_BELOW', 1);
+
+/**
+ * Comment controls should be shown both above and below the comment list.
+ */
+define('COMMENT_CONTROLS_ABOVE_BELOW', 2);
+
+/**
+ * Comment controls are hidden.
+ */
+define('COMMENT_CONTROLS_HIDDEN', 3);
+
+/**
+ * Anonymous posters may not enter their contact information.
+ */
+define('COMMENT_ANONYMOUS_MAYNOT_CONTACT', 0);
+
+/**
+ * Anonymous posters may leave their contact information.
+ */
+define('COMMENT_ANONYMOUS_MAY_CONTACT', 1);
+
+/**
+ * Anonymous posters must leave their contact information.
+ */
+define('COMMENT_ANONYMOUS_MUST_CONTACT', 2);
+
+/**
+ * Comment form should be displayed on a separate page.
+ */
+define('COMMENT_FORM_SEPARATE_PAGE', 0);
+
+/**
+ * Comment form should be shown below post or list of comments.
+ */
+define('COMMENT_FORM_BELOW', 1);
+
+/**
+ * Comments for this node are disabled.
+ */
+define('COMMENT_NODE_DISABLED', 0);
+
+/**
+ * Comments for this node are locked.
+ */
+define('COMMENT_NODE_READ_ONLY', 1);
+
+/**
+ * Comments are enabled on this node.
+ */
+define('COMMENT_NODE_READ_WRITE', 2);
+
+/**
+ * Comment preview is optional.
+ */
+define('COMMENT_PREVIEW_OPTIONAL', 0);
+
+/**
+ * Comment preview is required.
+ */
+define('COMMENT_PREVIEW_REQUIRED', 1);
+

=== modified file 'includes/install.inc'
--- includes/install.inc	2007-11-30 12:19:10 +0000
+++ includes/install.inc	2007-12-03 14:07:08 +0000
@@ -22,8 +22,10 @@ define('FILE_NOT_EXECUTABLE', 128);
  * Initialize the update system by loading all installed module's .install files.
  */
 function drupal_load_updates() {
-  foreach (module_list() as $module) {
-    module_load_install($module);
+  foreach (drupal_get_installed_schema_version(NULL, FALSE, TRUE) as $module => $schema_version) {
+    if ($schema_version > -1) {
+      module_load_install($module);
+    }
   }
 }
 
@@ -61,7 +63,7 @@ function drupal_get_schema_versions($mod
  * @return
  *   The currently installed schema version.
  */
-function drupal_get_installed_schema_version($module, $reset = FALSE) {
+function drupal_get_installed_schema_version($module, $reset = FALSE, $array = FALSE) {
   static $versions = array();
 
   if ($reset) {
@@ -76,7 +78,7 @@ function drupal_get_installed_schema_ver
     }
   }
 
-  return $versions[$module];
+  return $array ? $versions : $versions[$module];
 }
 
 /**

=== modified file 'modules/comment/comment.install'
--- modules/comment/comment.install	2007-11-26 19:55:15 +0000
+++ modules/comment/comment.install	2007-12-03 14:32:59 +0000
@@ -1,6 +1,8 @@
 <?php
 // $Id: comment.install,v 1.11 2007/11/26 19:55:15 goba Exp $
 
+require_once drupal_get_path('module', 'comment') . '/comemnt.constants.inc';
+
 /**
  * Implementation of hook_enable().
  */

=== modified file 'modules/comment/comment.module'
--- modules/comment/comment.module	2007-11-29 11:54:37 +0000
+++ modules/comment/comment.module	2007-12-03 14:32:46 +0000
@@ -10,115 +10,7 @@
  * a forum topic, weblog post, story, collaborative book page, etc.
  */
 
-/**
- * Comment is published.
- */
-define('COMMENT_PUBLISHED', 0);
-
-/**
- * Comment is awaiting approval.
- */
-define('COMMENT_NOT_PUBLISHED', 1);
-
-/**
- * Comments are displayed in a flat list - collapsed.
- */
-define('COMMENT_MODE_FLAT_COLLAPSED', 1);
-
-/**
- * Comments are displayed in a flat list - expanded.
- */
-define('COMMENT_MODE_FLAT_EXPANDED', 2);
-
-/**
- * Comments are displayed as a threaded list - collapsed.
- */
-define('COMMENT_MODE_THREADED_COLLAPSED', 3);
-
-/**
- * Comments are displayed as a threaded list - expanded.
- */
-define('COMMENT_MODE_THREADED_EXPANDED', 4);
-
-/**
- * Comments are ordered by date - newest first.
- */
-define('COMMENT_ORDER_NEWEST_FIRST', 1);
-
-/**
- * Comments are ordered by date - oldest first.
- */
-define('COMMENT_ORDER_OLDEST_FIRST', 2);
-
-/**
- * Comment controls should be shown above the comment list.
- */
-define('COMMENT_CONTROLS_ABOVE', 0);
-
-/**
- * Comment controls should be shown below the comment list.
- */
-define('COMMENT_CONTROLS_BELOW', 1);
-
-/**
- * Comment controls should be shown both above and below the comment list.
- */
-define('COMMENT_CONTROLS_ABOVE_BELOW', 2);
-
-/**
- * Comment controls are hidden.
- */
-define('COMMENT_CONTROLS_HIDDEN', 3);
-
-/**
- * Anonymous posters may not enter their contact information.
- */
-define('COMMENT_ANONYMOUS_MAYNOT_CONTACT', 0);
-
-/**
- * Anonymous posters may leave their contact information.
- */
-define('COMMENT_ANONYMOUS_MAY_CONTACT', 1);
-
-/**
- * Anonymous posters must leave their contact information.
- */
-define('COMMENT_ANONYMOUS_MUST_CONTACT', 2);
-
-/**
- * Comment form should be displayed on a separate page.
- */
-define('COMMENT_FORM_SEPARATE_PAGE', 0);
-
-/**
- * Comment form should be shown below post or list of comments.
- */
-define('COMMENT_FORM_BELOW', 1);
-
-/**
- * Comments for this node are disabled.
- */
-define('COMMENT_NODE_DISABLED', 0);
-
-/**
- * Comments for this node are locked.
- */
-define('COMMENT_NODE_READ_ONLY', 1);
-
-/**
- * Comments are enabled on this node.
- */
-define('COMMENT_NODE_READ_WRITE', 2);
-
-/**
- * Comment preview is optional.
- */
-define('COMMENT_PREVIEW_OPTIONAL', 0);
-
-/**
- * Comment preview is required.
- */
-define('COMMENT_PREVIEW_REQUIRED', 1);
+require_once drupal_get_path('module', 'comment') . '/comemnt.constants.inc';
 
 /**
  * Implementation of hook_help().
@@ -1318,7 +1210,7 @@ function comment_form(&$form_state, $edi
   if (!form_get_errors() && ((variable_get('comment_preview_'. $node->type, COMMENT_PREVIEW_REQUIRED) == COMMENT_PREVIEW_OPTIONAL) || ($op == t('Preview')) || ($op == t('Save')))) {
     $form['submit'] = array('#type' => 'submit', '#value' => t('Save'), '#weight' => 19);
   }
-  
+
   $form['preview'] = array('#type' => 'button', '#value' => t('Preview'), '#weight' => 20);
   $form['#token'] = 'comment'. $edit['nid'] . (isset($edit['pid']) ? $edit['pid'] : '');
 

=== modified file 'modules/system/system.install'
--- modules/system/system.install	2007-11-30 18:11:29 +0000
+++ modules/system/system.install	2007-12-03 14:05:45 +0000
@@ -1040,6 +1040,10 @@ function system_schema() {
  * @{
  */
 
+function system_update_last_removed() {
+  return 179;
+}
+
 function system_update_180() {
   $ret = array();
 

=== modified file 'update.php'
--- update.php	2007-11-30 12:19:10 +0000
+++ update.php	2007-12-03 14:05:57 +0000
@@ -334,12 +334,14 @@ function update_script_selection_form() 
   // Ensure system.module's updates appear first
   $form['start']['system'] = array();
 
-  foreach (module_list() as $module) {
+  $modules = drupal_get_installed_schema_version(NULL, FALSE, TRUE);
+  foreach ($modules as $module => $default) {
     $updates = drupal_get_schema_versions($module);
+    // module_invoke returns NULL for nonexisting hooks, so this checks both
+    // whether module is installed and whether is safe to update module.
     if ($updates !== FALSE) {
       $updates = drupal_map_assoc($updates);
       $updates[] = 'No updates available';
-      $default = drupal_get_installed_schema_version($module);
       foreach (array_keys($updates) as $update) {
         if ($update > $default) {
           $default = $update;

