7

I'm finding that every small change I make to the hooks I have to disable and re-enable a module. Is there a easy way to do this than having to go through to the module menu, uncheck the module, click save configuration and wait for a while, then recheck the module, and click save configuration again?

1
  • 6
    Disabling and enabling modules is not needed for changed/new hooks, just clearing the cache, unless they're the 5 hooks usually put in the .install file. Apr 17 '11 at 0:36
6

The devel module includes a page that will let you disable and re-enable modules in a single step. The page can be hard to find though, but if you enable one of the Devel blocks, it's listed in there.

You can also do it relatively easily from the command line using Drush.

16

For quick disabling and re-enabling of modules, try drush dre module1, module2.

This is a Devel command, so you need to have that installed, and enabled. You just need to be sure you put them in the right order according to their relative dependencies; should module1 be dependent on module2, it wouldn't work.

0
10

Using Drush from the command line saves a lot of time, not only with enabling and disabling modules, but installing, updating, and many other tasks. It's a very powerful tool useful for many Drupal development tasks.

For example, to enable the module using drush you'd type (in terminal) drush en modulename. To disable same module you'd enter drush dis modulename. Much quicker than going through the admin UI.

However, your problem may be resolved by clearing the cache as the only hooks directly effected are hook_schema, hook_enable, hook_disable, hook_uninstall, and hook_install (you can also clear the cache in Drush using the command drush cc all).

2

If you have lots of modules to enable and disable, just create a module that will enable/disable a selection of modules all in one go. Then use drush dis on that module do disable all the modules.

1
  • You meant to add dependencies or hook_enable/disable ?
    – AKS
    Nov 27 '12 at 17:47

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.