Problem/Motivation
On updating a module to a version that has a dependency on an earlier version of Drupal core, update.php cannot be run.
Steps to reproduce
- Install Drupal 7.10.
- Go to '/admin/modules/install' and install module Menu Block v. 7.x-2.2 (http://ftp.drupal.org/files/projects/menu_block-7.x-2.2.tar.gz).
- Enable Menu Block module in '/admin/modules'.
- Check for updates here '/admin/reports/updates/check?destination=admin/modules/update'.
- Select the update for Menu Block in '/admin/modules/update' and download and upgrade it to version 7.x-2.3.
- Go to '/update.php'. The update will not run but returns this error message:
"Error Unresolved dependency Menu (Version >7.11 required)
Menu Block requires this module and version. Currently using Menu version 7.10"
Proposed resolution
It has been suggested that the update module detects the missing dependency and rolls back the update. Alternative suggestions to resolve this issue include providing dependency metadata in the module obtained from the module's .info file or backing up the currently installed module before updating and reverting if necessary.
Remaining tasks
To develop a method of checking dependencies prior to upgrading modules.
User interface changes
None
API changes
None
Original report by mstrelan
On a Drupal 7.7 site I've updated Menu Block from 7.x-2.0-beta4 to 7.x-2.3 and now cannot run update.php because Menu Block requires Drupal 7.11 or higher.
Is there a way update.module can detect this missing dependency earlier and rollback the update to the module?
Comments
Comment #1
r_wel commentedI've worked for days unsuccessfully trying to upgrade from 7.8 to 7.12 Finally decided to goto 7.11. After upgrade, I cannot run update.php due to this dependency error. Searching through site and googling has not given me an answer (at least not that I understand) on how to resolve this.
Unresolved dependency Menu (Version >7.11 required). Menu Block requires this module and version. Currently using Menu version 7.11
Comment #2
pillarsdotnet commentedWorkaround: Edit your
menu_block/menu_block.infofile and change or remove the dependency.Comment #3
pingers commentedI see a couple of solutions...
* provide dependency meta data when checking for updates (obtained from info file by packaging script?) to resolve dependency issues in advance (before download)
or
* backup current modules (like drush) and resolve dependencies after download (and revert modules if necessary)
Any other ideas?
Comment #4
catchComment #5
franz+1 to providing the metadata. Backing up to rollback later looks like a big effort that can also open a can of worms and a lot of unnecessary slow operations. What if it crashes before being able to rollback? Also, what if the dependency is there because the it causes an WSOD with an older version of Drupal? You get a deadlock there.
Comment #6
xjmComment #7
chx commentedSorry but you should never ever attempt to update a live site without testing on a copy first. Our first documentation team leader, sepeck 5-6 years ago used "Test site, always start with a test site" as his signature. This still stands. You test what works and what doesn't. I do not think this is not a regression in any way, this is new feature.
Comment #8
franzWho said "live"? Even in a test site, this is unexpected behavior that wastes time, IMO.
Comment #9
rkjha commentedI also believe that it is more a sort of bug than "not a feature". Even when you work on your test site, you don't expect such unexpected behavior.
Comment #10
welly commentedIssue summary provided.
Comment #11
ooystein commentedSteps to reproduce
"Error Unresolved dependency Menu (Version >7.11 required)
Menu Block requires this module and version. Currently using Menu version 7.10"
Comment #11.0
ooystein commentedIssue summary updated
Comment #11.1
ooystein commentedAdded STR
Comment #11.2
ooystein commentedMove STR to "Problem/Motivation" paragraf
Comment #11.3
star-szrMake STR into a numbered list
Comment #12
camoa commentedJust a question out of ignorance, Isn't it easy if the XML file adds attributes for the dependencies? That way you avoid a lot of disk activity in the update. You will have to uncompress the file before update, get the info file, parse it get dependencies. Everytime you run updates.
What if this is done at the "backend" once per every release? and pass into the XML file. Once this is done, vreating a patch will be a little easier, and done before updating anything. Making the module create a kind of cyclic update, publishing only those with dependencies already covered. Or something like that.
I may be talking out of ignorance here.
Comment #26
catchMarking outdated. Automatic updates handles this, and the feature to install modules via URL is in the process of being removed from core.
#3417136: Remove adding an extension via a URL
#3502973: Remove UI and routes for the ability to update modules and themes via update.module and authorize.php
https://www.drupal.org/project/automatic_updates