Index: update.php
===================================================================
RCS file: /cvs/drupal/drupal/update.php,v
retrieving revision 1.238
diff -u -r1.238 update.php
--- update.php 30 Nov 2007 12:19:10 -0000 1.238
+++ update.php 6 Dec 2007 14:11:51 -0000
@@ -328,25 +328,36 @@
'#type' => 'fieldset',
'#title' => 'Select versions',
'#collapsible' => TRUE,
- '#collapsed' => TRUE,
+ '#collapsed' => FALSE,
);
// 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 => $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.",
+ '#prefix' => '
',
+ '#suffix' => '
',
+ );
+ 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',
Index: includes/install.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/install.inc,v
retrieving revision 1.50
diff -u -r1.50 install.inc
--- includes/install.inc 30 Nov 2007 12:19:10 -0000 1.50
+++ includes/install.inc 6 Dec 2007 12:37:10 -0000
@@ -22,8 +22,10 @@
* 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 @@
*
* @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 @@
}
}
- return $versions[$module];
+ return $array ? $versions : $versions[$module];
}
/**
Index: modules/comment/comment.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.install,v
retrieving revision 1.11
diff -u -r1.11 comment.install
--- modules/comment/comment.install 26 Nov 2007 19:55:15 -0000 1.11
+++ modules/comment/comment.install 6 Dec 2007 11:59:22 -0000
@@ -1,6 +1,8 @@