=== modified file 'includes/install.inc' --- includes/install.inc 2007-11-30 12:19:10 +0000 +++ includes/install.inc 2007-12-05 11:44:59 +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); + } } } @@ -58,10 +60,15 @@ function drupal_get_schema_versions($mod * * @param $module * A module name. + * @param $reset + * Set to TRUE after modifying the system table. + * @param $array + * Set to TRUE if you want to get information about all modules in the + * system. * @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 +83,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-05 11:44:59 +0000 @@ -1,6 +1,8 @@ $schema_version) { $updates = drupal_get_schema_versions($module); - if ($updates !== FALSE) { + if ($updates !== FALSE && $schema_version >= 0) { + // module_invoke returns NULL for nonexisting hooks, so if no updates + // are removed, it will == 0. + $last_removed = module_invoke($module, 'update_last_removed'); + if ($schema_version < $last_removed) { + $form['start'][$module] = array( + '#value' => "$module can not be updated. It's schema version is $schema_version and updates up to $last_removed have been removed. You need to install an older version of Drupal and update this module first if you want to use $module in the future.", + ); + continue; + } $updates = drupal_map_assoc($updates); $updates[] = 'No updates available'; - $default = drupal_get_installed_schema_version($module); + $default = $schema_version; foreach (array_keys($updates) as $update) { - if ($update > $default) { + if ($update > $schema_version) { $default = $update; break; } } - $form['start'][$module] = array( '#type' => 'select', '#title' => $module .' module',