DrupalKernel::initializeContainer is very complex. It has to account for several situations where module lists can change, making the code hard to understand and even harder to refactor. The usage of instance variables made methods dependent on other methods being called first, which is as hard to maintain as any of our previous bootstrap code. DrupalKernel also has a bunch of supporting methods to maintain it's module list, which doesn't make much sense considering we have a ModuleHandler class now.
This patch is an attempt to factor this code out into a ModuleHandlerFactory, which will read in the module list every time from config, much like DrupalKernel was doing. The result is a much simpler kernel with less state to maintain.
Doing this required the removal of the updateModules method as well. To try to simplify the process of the kernel being notified that the container needs to be rebuilt, I replaced all of that with a simple event and a new callback method for when the container needs to be rebuilt using the module list from config.
It's possible I missed something in the requirements, but in my limited testing, it appears to work ok.
Attachment | Size | Status | Test result | Operations |
---|---|---|---|---|
kernel-module-handler-refactor.patch | 23.22 KB | Idle | FAILED: [[SimpleTest]]: [MySQL] 50,128 pass(es), 184 fail(s), and 0 exception(s). | View details | Re-test |