Problem/Motivation
Projects that contain multiple modules are listed on the updates page only once, and show the version of the parent module, regardless of the versions of the child modules. This means a user could have outdated versions of the sub-modules on their site without realising.
Steps to reproduce
- Install a contributed project with multiple modules
- Download an older version of the project
- Replace one of the sub-modules with the older version
- Check the updates page and confirm it displays the version of the parent module only
- In this example, the site is running Metatag 8.x-1.14, and Metatag: Dublin Core 8.x-1.12. The updates page shows:

Proposed resolution
If there is a mismatch between modules in a project, show a warning message on the updates page that links to the status report page with more information on the issue, e.g.:

And on the status report page, include a warning:

(These messages are just first suggestions, I have not put too much thought into the actual text)
Remaining tasks
- Agree on approach
- Write patch with tests
- Review
User interface changes
On the status report page,
API changes
N/A
Data model changes
N/A
Release notes snippet
N/A
Original report by [username]
Over at http://drupal.org/node/165778 we debugged a support problem where update_status appeared to be displaying the wrong version for the site's currently installed cck. The problem was that old versions of cck included date.module directly inside the cck directory, but that's since been moved into a separate project. When the user upgraded to the later version of CCK, the old date.info file was left in their directory with the stale version, and that confused update_status.
It'd be nice if inside update_status_get_projects(), when we've found another module for an existing project we know about, we should compare the version field in the .info file to the one we're using as the canonical one for the project. If they disagree, we should record that fact some how, and display it on the available updates report. A trivial approach would be to just append the mismatched version string to the module name we store, so you'd see something like this:
Includes: content, date (5.x-1.0-beta), nodereference, number, text, ...
| Comment | File | Size | Author |
|---|---|---|---|
| #34 | Screen Shot 2020-10-08 at 8.30.08 am.png | 34.71 KB | pameeela |
| #34 | Screen Shot 2020-10-08 at 8.26.26 am.png | 12.94 KB | pameeela |
| #34 | Screen Shot 2020-10-08 at 8.23.31 am.png | 24.22 KB | pameeela |
| #19 | update_version_mismatch_4.patch | 5.12 KB | David_Rothstein |
| #17 | update_version_mismatch_3.patch | 5.74 KB | David_Rothstein |
Comments
Comment #1
nancydruPerhaps my feature request to show the directory would play into this?
Comment #2
David_Rothstein commentedNote that it is not just version strings that have this problem, but also datestamps (see http://drupal.org/node/227644).
Comment #3
David_Rothstein commentedActually, I just checked that this occurs in Drupal 6 core too, and it does.
Feel free to change back if you disagree, but I think this qualifies as a bug. If I am running (for some stupid reason) a "mixed" version of Drupal, with some modules up to date and some modules out of date and potentially insecure, Update Status should not tell me that everything is OK -- it should tell me that there's a problem. What happens now is that it picks one module from the project at random (I think it uses the one that comes first alphabetically) and uses that module to assign the overall project version number. It really should check all of them to be safe.
So am I correct that the following is the desired behavior?
Comment #4
dwwYeah, I guess we could call this a bug. ;) However, I'm not going to roll a patch for D6 core until I get some more support on the idea that this is a bug and the fix will be committed to DRUPAL-6 when it's ready. Should be relatively easy, and it should even be possible to fix this without breaking the string freeze.
Comment #5
David_Rothstein commentedHm, I had intended to write a patch for this weeks ago.. but better late than never ;)
The attached patch is for 7.x and does two things:
1. Assigns the overall project information based on the oldest module it finds, to maximize the chances of catching out-of-date code. (And if several modules have the same datestamp, it attempts to choose between them by picking the one with the "earliest" version string.)
2. If there is any version mismatch, all the version strings get printed out on the update report.
In the vast majority of cases, the version mismatch will also generate an error on the update report, since the older module will be out of date. In a few edge cases, though, I think you could still get the "up to date" checkmark telling you the project is OK (for example, if your project contains modules from two separate supported versions of the project, e.g., 6.x-1.0 and 6.x-2.0). I'm not sure it's really worth the effort required to deal with that, though.
As for eventually porting this to 6.x, I think the first part of the patch is undeniably a bug fix that should be backported.... right? But the second part (printing the version strings to the screen) is less so.
Comment #6
dwwCool, thanks. I'll have to take a much closer look at this than I have time for right now. In particular, it's important that these changes happen in a way that will allow CVS deploy to keep working, which I haven't yet verified.
One minor thing I noticed from a very quick skim of the patch:
_update_unknown_version_string()should probably betheme_update_unknown_version().It'd also be nice to do this in a way that doesn't break any t() strings, but I'm not sure that's possible with your attempted strong tags. Perhaps we don't need strong. Perhaps just the presence of a version string in that list will be enough to grab people's attention?
Comment #7
David_Rothstein commentedHere is a new patch using
theme_update_unknown_version()... definitely a good idea, thanks.About breaking t() strings, I figured that since this patch is for 7.x, we don't need to worry about that (??). If this gets backported to 6.x, then I agree, we should definitely get rid of the <strong> tags (but I'm not sure that part of the patch will get backported anyway?). The <strong> tags certainly aren't crucial either way, but it's a little bit nice to have it highlight for you which of your modules is the one causing the version mismatch, I think.
For CVS Deploy, I reviewed the code a bit, and I think this patch won't have any effect on checkouts of official project releases. For dev versions, it looks like the changes it makes to the datestamp calculation will make the bug at http://drupal.org/node/227644 appear more often than it currently does. (My hope was to fix that bug after this one anyway, though.) I think this might be inevitable, though... for a CVS checkout, a project's datestamp really should be set to the newest one it finds in all the sub-modules, but here, we want the exact opposite behavior. So I think CVS Deploy would just need to be patched to override what is happening here and do its own calculation of the overall project datestamp.
Comment #8
gábor hojtsyThe change with %includes to !includes should not be that big of a problem, there were such small changes before. As long as the usability / correctness of the information is worth it (and it looks like it does), such small changes are workable IMHO.
Comment #9
dries commentedI agree that this would be nice to have. I haven't tested the patch yet, so it is not clear how well the information is presented.
Comment #10
dwwExcellent. If both core committers are ok with a minor string breakage for this, I can resume work here. I've basically just been on hold with this pending a decision that it was worth the time. I'll try to get to this (and some other, related update.module patches) in the near future so we can fix these up in core. Yay. ;)
Comment #11
David_Rothstein commentedHere is a screenshot showing what this patch currently does. If we did it without breaking strings, the screenshot would look exactly the same, but the offending module(s) -- in this case the comment module -- would not have their version strings in bold.
Note that the versions only get printed for sites which have a mismatch, but the string breakage would happen for everyone, so that might be something to keep in mind for Drupal 6.
Comment #12
dries commentedThanks for the screenshot, David. That is really helpful.
I think it looks good, but I'm not sure it is 100% intuitive. That said, it is better than nothing, and I'm not sure how else to present this information.
Comment #13
gábor hojtsyI think it is good with the bolding even if that brakes this short string, as it is important to show there. We broke such short strings before.
Comment #14
David_Rothstein commentedDries, I agree it isn't quite perfect yet. Here are a couple things I can think of that might make it more intuitive (any of these would be very simple to implement):
This would involve adding a new string rather than breaking an existing one.
Or possibly some combination of the above...
Comment #15
dwwI'd prefer a combo of the extra intro text and the whole module + version in bold.
Comment #16
gábor hojtsyFine with me.
Comment #17
David_Rothstein commentedDone.
Comment #18
David_Rothstein commentedOops, there's a (minor) problem with this patch. I realized that theme_update_unknown_version() is not particularly "themeable", since its output gets run through check_plain() somewhere inside theme_update_report().
Maybe the simplest solution is just to not have it be a themeable function; we could change it back to update_unknown_version_name() or something like that...
Comment #19
David_Rothstein commentedNew version attached; this makes the function non-themeable again and also fixes a minor code style issue that was lurking in there.
Otherwise this is the same as the previous patch.
Comment #20
dries commentedTwo more comments:
* While I think this is an improvement, I wonder why we don't put the conflicting modules in red? To me, that looks more conflicting than bold. (This is not a requirement for the patch to get committed.)
* Many users will scratch their head and try to figure out how to resolve the conflict. Usability 101 tells you to explain your users how to fix this.
Can we massage this a little bit more?
Comment #21
dwwThis patch doesn't apply at all anymore, now that #162788: Include modules that aren't enabled landed. In fact, that opens up a new UI can of worms here. What should we do about version mismatches in light of disabled vs. enabled modules? Looks like we need some UI review here before it's worth rerolling this.
Comment #22
dave reidTalked with dww on this and discussed how I felt this should be more centered towards a status report warning if there are version mismatches found since we put important potential-site-breaking things there. However, this is also relevant to the update status page since it affects if and which version is available to upgrade to.
Comment #23
johnalbinSubscribing since this happens in sub-themes often.
Comment #24
dww@JohnAlbin: I'm not even sure what this means if you have version mismatch with subthemes. You mean subthemes vs. base themes? That's the whole point of subthemes, right, that you *can* have a mismatch? Or do you mean the problem of version mismatch across multiple subthemes in the same project is common for some reason (and if so, why?)? Please elaborate. ;) Thanks!
Comment #25
Bojhan commentedDon't really get what this patch does.
Comment #34
pameeela commentedResurrecting this one after discussion with @dww in Slack. FWIW I don't think this is a bug, rather a task to handle an edge case. Updated the issue based on my testing with a suggested approach to address this.
I won't update the issue category but if anyone else agrees, please do.
Comment #35
quietone commentedI just asked for some feedback on the direction to take here from #ux.
Comment #39
larowlan@ainsofs, @pameeela, @quietone, @Seth Hilder and I discussed this at Drupal South
Whilst we agreed that this can put your site into a bad state, based on lack of activity and changes to how people update modules now (much higher composer use) as well as the level of effort that would be required to fix this edge case that this would be at best on minor, so we decided to change the priority.
However we also felt that the 'bug' here is not on behalf of Drupal but rather on that of the user, or documentation on how to update your site properly.
So as a result we felt this was better classified as a task.
However if you disagree @dww feel free to move it back in your capacity as update module maintainer
Comment #40
larowlan