Book Image

Drush for Developers - Second Edition

By : Juan Pablo Novillo Requena, Juan P Novillo Requena
Book Image

Drush for Developers - Second Edition

By: Juan Pablo Novillo Requena, Juan P Novillo Requena

Overview of this book

Table of Contents (13 chapters)
Drush for Developers Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
2
Keeping Database Configuration and Code Together
Index

Summary


In this chapter, we covered many tools to help you write safe code and make the most of Drush's APIs. We started by discovering how input data is processed by Drush and how we can alter its behavior to fit our needs. Custom validation can also be implemented in a hook so that it runs its checks before the actual command.

Preparing our commands for unexpected errors is key in any project. Drush's rollback mechanism gives us a chance to take action if a command fails, so we can make any required cleanup and logging. We saw how our update path script can benefit from this mechanism in order to become more robust.

For times when we are writing a custom command, being aware of which Drush hooks are available and when they are executed is useful in order to split the logic in the most appropriate way. The --show-invoke option provides detailed information about each of the callbacks that Drush attempts to call during a command execution.

Whenever we use a command, Drush goes through a bootstrap...