18

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.

32

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.

  • You are a life saver. You (and drush) have no doubt saved me hours (eventually). – gregghz Nov 11 '11 at 22:11
  • 8
    drush devel-reinstall modulename – xandeadx Nov 11 '11 at 22:37
  • 2
    drush devel-reinstall modulename -y The -y means you don't have to keep entering y to continue. – Felix Eve Feb 12 '14 at 16:27
  • 2
    If you have devel (you should), run drush dre mymodule – DrupalDrop Mar 24 '14 at 15:03
  • 1
    the most efficient command is drush dre MODULENAME -y – DrCord Jan 4 '16 at 23:46
8

If you don't have shell access the Devel module provides such functionality. Install it and visit mysite.com/devel/reinstall.

  • oh this indeed reinstalls a module, but what about updating a custom module as you would do with the "install new module" button and then uploading a zipped version? :/ I am in a situation where the drupal site is on a cloud platform, and I don't have the luxury of drush / file system access. – hello_earth Aug 9 '18 at 11:15
-1

For those of you that want a script that does the devel command without the devel: https://github.com/nategd/drupal_module_restart

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.