Problem/Motivation

1) Website notifies you of pending update, and to run update.php
2) Run update.php, receive the message; "Some of the pending updates cannot be applied because their dependencies were not met." with no useful details to debug the problem.

Conditions necessary to reproduce:

The only modules with pending updates need to all have incompatible schema versions. (For example, only one module requires an udpate, but it's schema version is incompatible).

There are a number of ways to reproduce it, but the easiest way would probably to do the following:

Pick a module that has implemented hook_update_last_removed(); (I originally encountered this problem via the mail_edit module)

https://api.drupal.org/api/drupal/modules%21system%21system.api.php/func...

Install an older version of that module, one that has a different database schema than the most recent (for instance if 7.11 is available, install 7.09).

Then connect to your database and change the schema_version value in the system table for that module to a value that will return false for hook_update_last_removed(); (like 3000 or something silly).

Then, attempt to update the module.

Programmatic Cause

In update.php at line 62 it checks each module to be updated and creates a form element. On line 64 it saves a form element, themed as a warning message, for each module update that is not compatible with it's existing schema version.

Then, at line 87 it increments a $count for only the modules with valid pending updates.

And finally, at line 111 if $count is zero, it will unset the form (and potentially hide the valid and important warning messages added at line 64).

Proposed resolution

Unsetting the form when there are no valid pending updates makes sense, and changing this logic would create other problems. I recommend instead of adding a warning-message-themed form element for the invalid updates we simply use drupal_message() to display the warning.

Remaining tasks

Patch needs to be reviewed.

User interface changes

When there are invalid (incompatible schema version) updates the warning will appear where drupal_messages are displayed instead of in a form element.

API changes

None.

Comments

K.MacKenzie’s picture

patch Added

K.MacKenzie’s picture

Status: Active » Needs review
mimes’s picture

I can't seem to reproduce this issue. I've tried installing modules with incompatible update schema versions, but it is not triggered. Could you provide a more detailed explanation of how to do so?
The patch itself appears as though it should work.

K.MacKenzie’s picture

There are a number of ways to reproduce it, but the easiest way would probably to do the following:

Pick a module that has implemented hook_update_last_removed(); (I originally encountered this problem via the mail_edit module)

https://api.drupal.org/api/drupal/modules%21system%21system.api.php/func...

Install an older version of that module, one that has a different database schema than the most recent (for instance if 7.11 is available, install 7.09).

Then connect to your database and change the schema_version value in the system table for that module to a value that will return false for hook_update_last_removed(); (like 3000 or something silly).

Then, attempt to update the module.

K.MacKenzie’s picture

Issue summary: View changes

Version: 7.24 » 7.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.

Status: Needs review » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.