Quick Uninstall/Reinstall of a Custom Module
-
16-10-2019 - |
Pergunta
I'm working on creating a module and I'm slowly getting familiar with the Field API and what all settings work on various fields and what don't. While I'm doing this, it seems that the only way to update a custom content type is to disable the module, uninstall it, then re-enable it.
Is there an easy way to do this? Right now, it's a somewhat laborious process that requires a handful of clicks to do the same thing over and over. I'm looking for a script or module to handling this very quickly with (ideally) a single click.
Solução
Solution 1. Devel + Drush:
You can use devel drush command for module re-installation with all the module dependencies:
drush devel-reinstall modulename
There is also alias for this command
drush dre modulename
Solution 2. Drush:
This is something that I would typically use drush for
drush pm-disable mymodule
drush pm-uninstall mymodule
drush pm-enable mymodule
You could also use it to define your own custom commands to combine these into a single command.
Outras dicas
If you don't have shell access the Devel module provides such functionality. Install it and visit mysite.com/devel/reinstall.
For those of you that want a script that does the devel command without the devel: https://github.com/nategd/drupal_module_restart