Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

3. Customizing Drush > Altering and reacting to existing commands

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 going to be executed.

  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial