O'Reilly logo

Drush User's Guide by Juan Pablo Novillo Requena

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Altering and reacting to existing commands

Drush offers a very broad list of hooks to interact with existing commands. We can modify, react and extend them however we need it. We are going to demonstrate this by first describing each hook and then writing and testing an example that uses some of them. Following is the full list of hooks sorted by the order in which they are called with a short description of each one:

  • hook_drush_init() is executed before any command is run.
  • drush_COMMAND_init() is called before a command is validated.
  • drush_hook_COMMAND_validate() validates a command. We used it in our custom command example in the previous section (drush_userblocker_user_blocker_validate()).
  • drush_hook_pre_COMMAND() operates before a command is ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required