Closed fooman closed 9 years ago
Good observation and we'll take a look but I bet this is a chicken/egg issue since the module name is in the module.xml and we need that to understand which are disabled through config.php.
So I guess one way to solve the chicken/egg problem then would be to first look in config.php
and have it as a requirement that the path matches the module name.
app/code/Namespace/Module/etc/module.xml file
would only be read if Namespace_Module
is enabled.
in other words the following
app/code/Namespace/Module/etc/module.xml file
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="SomeOtherNamespace_SomeOtherModuleName" version="2.0.0"/>
</config>
would be disallowed. This would work for me but not sure if this change would be worth it. Maybe the result of a failed validation can be made less drastic.
The goal of disabling a module is not to disable badly implemented modules (e.g. bad module.xml file) but rather to turn a module off for a period of time. E.g. a merchandising extension talking to a SaaS service that is down at the moment - turn the module off until its working again. With Composer, if you really don't need a module then remove it from your site completely. Its easy to add it back later.
So we will have a bit of a think, but I suspect I agree its probably not worth changing (compared to other work to be done). Other fish to fry!
The config.php is created based on what's in module.xml. For not enabled modules, the config.php will have a record in the list with 0 value.
@fooman I removed the bug tag, as this seems more of question than bug. Let's know if your query was answered by @antonmakarenko. If yes, let's close this issue.
Currently, the methods that request module.xml information are used only in the following places:
In the second case, The algorithm can be optimized to avoid those modules that are not enabled. It will be a performance optimization at a cost of more complexity. IMO it is not worth the effort.
I think this can be closed as wontfix with effort not worth the payoff.
Discussion is closed.
It appears that the module.xml gets parsed even though the extension has not been explicitly enabled. For example this app/code/Namespace/Module/etc/module.xml file (note the incorrect use of version vs schema_version):
will take down the store with this error message:
I believe this contradicts the stated goal of the config.php approach to separate code being present and code being executed after a deployment.