Book Details

About This Book

Write your own commands, hook in to alter existing ones and extend the toolkit with a long list of contributed modules.

A practical guide full of examples and step-by-step instructions to start using Drush right from Chapter 1.

Use the hashtag #PacktDrush on Twitter to discuss the book with the author, fellow readers, and Packt.

Who This Book Is For

Drupal developers or themers who understand Drupal administration’s basic concepts. Drush can make building any kind of website quicker and easier, no matter if it is a development environment, beta, a simple blog or a complex system.

Table of Contents

Chapter 1: Installation and Basic Usage

Introduction

Installation requirements

Installation for Linux and Unix (including Mac)

Installation on Windows

Drush command structure

Telling Drush which site to work with

Summary

Chapter 2: Executing Drush Commands

Downloading and installing Drupal (site-install)

Configuring a site (variable-set and variable-get)

Working with projects (pm-X and user-X)

Creating users and user roles

Clearing out cached data and image styles (cache-clear and image-flush)

Running cron (core-cron)

Working with a site's database (sql-X commands)

Backing up and restoring entire websites (archive-dump and archive-restore)

Monitoring watchdog messages (watchdog-X)

Summary

Chapter 3: Customizing Drush

Writing a custom command

Altering and reacting to existing commands

Executing custom PHP scripts

Type less and do more with Drush Site Aliases

Using configuration files

Optimizing the terminal for Drush

Summary

Chapter 4: Extending Drush

Backing up and migrating sites

Reinstall, inspect modules, and generate data

Working with features

Managing views from the command line

Generating a custom module codebase

Packaging module information in make files

Summary

What You Will Learn

Learn how to install Drush on different systems, and download and install a full Drupal site in seconds.

Understand Drush’s command structure with options and arguments.

Discover how to set a site to maintenance mode and other common settings with just one command.

Back up and restore code, files and databases into one file.

Learn to write your own Drush commands and name sites by aliases for even shorter commands.

Manage modules and users, monitor messages and run automated tests.

In Detail

Drush is a command line interface for Drupal. Most of the tasks for building and maintaining a website are repetitive and involve filling in forms on administration pages. The majority of these tasks can be achieved with a single Drush command, shortening the development and maintenance time of a project drastically.

Drush User’s Guide will allow you to be more productive and efficient in building and maintaining your Drupal sites through the command line. You will learn to install Drush on different platforms, and manage and configure your Drupal site by learning how to use and create Drush commands.

Become a Drush expert by exploring its command toolkit; customizing it to suit your needs, and extending it with contributed modules.

The command line will allow you to download, enable and upgrade Drupal projects in seconds. Back up your files, code and data in one single file, clear the cache, interact with databases, and deploy sites to remote machines – all using simply the command line. Use Drush with your own commands or alter existing ones; and extend the toolkit with a long list of contributed modules.

Drush User’s guide has everything you need to extend your use of the command line to easily build and manage your Drupal sites.

Authors

Juan Pablo Novillo Requena

Juan started building PHP websites professionally in London after finishing his University studies in 2006. He spent some time using Symfony and Ruby on Rails and in 2010, back in Spain, he created his first website with Drupal. His commitment with the Drupal Community started a year later once he discovered how much fun and challenging it was to contribute. Currently, he maintains several modules such as Twitter and Oauth among others, he frequently submits and reviews patches for other projects (recently Drush), he participates in the Madrid and Spanish communities with talks and code sprints and overall he does his best to help Drupal evolve and become known to a wider audience.

I would like to thank Lorena for her everyday support in my career and life. My family for believing in me and being so helpful. Also, thanks to my colleague Tushar Mahajan (http://drupal.org/user/398572), whose passion for Drupal and guidance was what got me into all this up to a level I could not even imagine.

Juan's Drupal profile can be found at http://drupal.org/user/682736.

Table of Contents

Chapter 1: Installation and Basic Usage

Introduction

Installation requirements

Installation for Linux and Unix (including Mac)

Installation on Windows

Drush command structure

Telling Drush which site to work with

Summary

Chapter 2: Executing Drush Commands

Downloading and installing Drupal (site-install)

Configuring a site (variable-set and variable-get)

Working with projects (pm-X and user-X)

Creating users and user roles

Clearing out cached data and image styles (cache-clear and image-flush)

Running cron (core-cron)

Working with a site's database (sql-X commands)

Backing up and restoring entire websites (archive-dump and archive-restore)

Alerts & Offers

Series & Level

We understand your time is important. Uniquely amongst the major publishers, we seek to develop and publish the broadest range of learning and information products on each technology. Every Packt product delivers a specific learning pathway, broadly defined by the Series type. This structured approach enables you to select the pathway which best suits your knowledge level, learning style and task objectives.

Learning

As a new user, these step-by-step tutorial guides will give you all the practical skills necessary to become competent and efficient.

Beginner's Guide

Friendly, informal tutorials that provide a practical introduction using examples, activities, and challenges.

Essentials

Fast paced, concentrated introductions showing the quickest way to put the tool to work in the real world.

Cookbook

A collection of practical self-contained recipes that all users of the technology will find useful for building more powerful and reliable systems.

Blueprints

Guides you through the most common types of project you'll encounter, giving you end-to-end guidance on how to build your specific solution quickly and reliably.

Mastering

Take your skills to the next level with advanced tutorials that will give you confidence to master the tool's most powerful features.

Starting

Accessible to readers adopting the topic, these titles get you into the tool or technology so that you can become an effective user.

Progressing

Building on core skills you already have, these titles share solutions and expertise so you become a highly productive power user.