Commit 7f5caaac authored by webchick's avatar webchick

#915216 by catch, Damien Tournoud: Fixing update.php cannot apply updates error.

parent bf751d9a
......@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment