This project is read-only.

Should an Update call to a Module Cause a Dependencies check?

Topics: General, Writing modules
Aug 1, 2013 at 3:03 PM
Edited Aug 1, 2013 at 3:04 PM
One of my migrations files was (silently) failing to set up some queries correctly on a colleague's PC.

When we investigated, the reason was that code in the UpdateFromX() call in the migrations class was expecting a dependent module - contrib.projectionlayouts (specified in the module.txt) to have been enabled to create a Shape layout.

I would have expected that when clicking on "Update" in the Modules Admin, that the dependencies in the module.txt would be checked. However, they only seem to be checked when the module is enabled.

Is this by design, or is it a bug?

Frequently, modules will have dependencies added to them over time that were not there when the module was initially enabled, so to me it seems like a bug.
Aug 1, 2013 at 8:23 PM
It's a frequently raised and known issue. I'd file a bug, if only so that we can put it back on the table and discuss possible solutions. Do you think the module should be put into a disabled state if its dependencies are not found?
Aug 2, 2013 at 6:39 AM
Thanks Bertrand, I did think that this might have been raised before, but I couldn't find it.

I think that:
  1. The dependency should be enabled automatically if possible before running any migrations.
  2. If the dependency is not available, then it should raise a red message at the top of the admin Dashboard, and possibly highlight the module box in red in the module page to indicate it may not be working as intended.
  3. It's probably also a good idea that admins should not be able to update the module until the problem is resolved.
I haven't looked in detail at the process though.

Certainly a red message in the dashboard would be good, if nothing else.

I'll raise it as an issue.