Feature request from gabrielqs, posted on GitHub Jun 20, 2016
Hi,
Right now, when you enable/disable a module Magento's CLI clears the cache. That's helpful but there is still a lot to be done for a module to be really enabled while in production mode, ensuring the store is in an consistent state after it finishes. For instance, these are all the steps i take when doing enabling or disabling a module in production:
- Activate maintenance mode
- Enable/disable module (clears cache automatically and static content if we use the --clear-static-content parameter)
- Upgrade db resources
- Clear generated code (/var/generation AND /var/di)
- Compile code
- Static content deploy
- Disable maintenance mode
IMHO it would be more difficult to break things in production mode if the enable/disable process took care of all those steps. It is inconsistent, even dangerous, that it only clears the cache at this point.
I know it is possible to make things easier by creating a shell script that calls all of the necessary commands, but why not to make it automatic? The process will be the same for the biggest majority of the Magento user base after all.
My suggestion: Create a flag on the system configuration allowing admins to enable the automation of modules enabling/disabling process when in production mode. When enabled, instead of simply clearing the cache, the module:enable and module:disable commands would take all necessary measures to ensure the store is on a consistent state after it finishes. The whole process when automation is enabled would be similar to what i have described above. This flag would be true by default. If in any specific case an user needs a different deploy process, the flag can be set to false and then a custom process can be applied.
Regards,
Gabriel