summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-10-01 19:52:28 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-10-01 19:52:28 +0000
commit7f5caaacdca6de4876ee876a9d1de5ce97ea0c93 (patch)
tree99b902c0da43cde17a228bc2bf817e81e1abb2a7 /includes
parentbf751d9a94dca1b48f30a061aa09049c977fbda1 (diff)
downloadbrdo-7f5caaacdca6de4876ee876a9d1de5ce97ea0c93.tar.gz
brdo-7f5caaacdca6de4876ee876a9d1de5ce97ea0c93.tar.bz2
#915216 by catch, Damien Tournoud: Fixing update.php cannot apply updates error.
Diffstat (limited to 'includes')
-rw-r--r--includes/module.inc13
1 files changed, 12 insertions, 1 deletions
diff --git a/includes/module.inc b/includes/module.inc
index 71b6a5551..82319054e 100644
--- a/includes/module.inc
+++ b/includes/module.inc
@@ -404,8 +404,19 @@ function module_enable($module_list, $enable_dependencies = TRUE) {
// 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.