Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Drush for Developers - Second Edition
  • Table Of Contents Toc
Drush for Developers - Second Edition

Drush for Developers - Second Edition

By : Juan Pablo Novillo Requena, Juan P Novillo Requena
4.5 (6)
close
close
Drush for Developers - Second Edition

Drush for Developers - Second Edition

4.5 (6)
By: Juan Pablo Novillo Requena, Juan P Novillo Requena

Overview of this book

This book is a best fit for backend developers with a basic knowledge of Drupal's APIs and some experience using the command line. Perhaps you already worked on one or two Drupal projects, but have never dived deep into Drush's toolset. In any case, this book will give you a lot of advice by covering real-world challenges in Drupal projects that can be solved using Drush.
Table of Contents (8 chapters)
close
close
2
2. Keeping Database Configuration and Code Together
7
Index

Chapter 1. Introduction, Installation, and Basic Usage

Drush is a command-line interface for Drupal. It can also serve as an alternative to write scripts using PHP instead of BASH. The Drush ecosystem is vast. Every year, at DrupalCon, the Drush core team gives an update on the bleeding edge features being developed by them and by contributors all over the world.

Tasks such as clearing caches, running database updates, executing batch scripts, and managing remote websites are just a glimpse of what you can do with Drush.

Here is an example. Imagine that you have pushed new code for your website and need to run database updates. Normally this would involve the following steps:

  1. Back up your database.
  2. Open your web browser and navigate to http://example.com/user.
  3. Authenticate as administrator.
  4. Navigate to http://example.com/update.php.
  5. Run database updates and wait for a confirmation message.

Now, here is how you can accomplish the preceding steps with Drush:

$ drush @example.prod sql-dump > dump.sql
$ drush @example.prod updatedb --yes

That's it. We did not even have to open an SSH connection or a web browser. The first command created a database backup and the second one executed pending database updates. In both these commands, we used @example.prod, which is a Drush site alias used to load configuration details about a particular site. We will see Drush site aliases in detail in Chapter 5, Managing Local and Remote Environments.

Drush is highly customizable. You can adjust it to fit a specific workflow. This is especially helpful when working on a Drupal project within a team; you can define security policies, wrap commands with sensible defaults, sanitize a copy of the production database automatically, and so on. This is the area that this book will focus on. We will go through some common processes during a Drupal project and discover how we can automate or simplify them using Drush. Let's start!

This chapter is an introduction and will cover the following topics to get you up to speed:

  • Installation requirements
  • Drush command structure
  • Understanding Drush's context system
Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Drush for Developers - Second Edition
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon