Drush User’s Guide
|Also available on:|
- Stop clicking around administration pages and start issuing commands straight to your Drupal sites.
- 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.
Book DetailsLanguage : English
Paperback : 140 pages [ 235mm x 191mm ]
Release Date : April 2012
ISBN : 1849517983
ISBN 13 : 9781849517980
Author(s) : Juan Pablo Novillo Requena
Topics and Technologies : All Books, CMS and eCommerce, Drupal, Open Source, Web Development
Table of ContentsPreface
Chapter 1: Installation and Basic Usage
Chapter 2: Executing Drush Commands
Chapter 3: Customizing Drush
Chapter 4: Extending Drush
- Chapter 1: Installation and Basic Usage
- Installation requirements
- Installing php-cli on Debian and Ubuntu
- Installing php-cli on Mac
- Installation for Linux and Unix (including Mac)
- The installation process
- Installation on Windows
- Automatic installation
- Manual installation
- Installing required libraries
- Replacing the TAR Library
- Installing Drush
- Configure environment variables
- Verify the installation
- Configuring php.ini
- Drush command structure
- Executing a command
- Providing arguments to a command
- Modifying a command's behavior through options
- Command aliases
- Telling Drush which site to work with
- Explicit methods
- Chapter 2: Executing Drush Commands
- Downloading and installing Drupal (site-install)
- Configuring a site (variable-set and variable-get)
- Listing available variables
- Setting new values to variables
- Deleting variables
- Finding variables by name
- Working with projects (pm-X and user-X)
- Viewing project information
- Downloading and enabling modules
- Choosing a specific version of a project
- Disabling and uninstalling modules
- Viewing information about downloaded projects
- Upgrading modules
- Creating users and user roles
- Clearing out cached data and image styles (cache-clear and image-flush)
- Flushing the cache
- Deleting generated images from an image style
- 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)
- Chapter 3: Customizing Drush
- Writing a custom command
- Writing our command
- Analyzing the definition of our command
- Analyzing the implementation of our command
- Validating input
- Altering and reacting to existing commands
- Altering an existing command
- Executing custom PHP scripts
- Executing PHP code from the command line
- Executing PHP scripts
- Type less and do more with Drush Site Aliases
- Configuring a Local Alias
- Organizing Site Aliases within our system
- Interacting with remote sites
- Grouping related Site Aliases
- Creating a Grouped Alias file with our Local Site Alias
- Adding a Site Alias for the development site
- Things we can do with remote Site Aliases
- Synchronizing databases
- Synchronizing directories
- Sharing configuration within Grouped Aliases
- Using configuration files
- Optimizing the terminal for Drush
- Saving Drush CLI configuration into our profile
- Chapter 4: Extending Drush
- Backing up and migrating sites
- Installing the module and looking at the help information
- Generate and restore a backup
- Reinstall, inspect modules, and generate data
- Installing the module
- Reinstalling modules
- Inspecting source code
- Searching for hook implementations
- Viewing source code of functions and methods
- Generating users and nodes
- Working with features
- Managing views from the command line
- Generating a custom module codebase
- Packaging module information in make files
- Installing Drush Make
- Generating a make file out of an existing site
- Gathering information about our site and writing a make file
- Loading contents from the make file into a Drupal installation
Any Drupal developer interested in learning how to harness the power of a command-line interface for building and administering websites, should find Drush User's Guide a worthwhile tutorial. -Michael J. Ross, web developer and Slashdot reviewer.
Download the code and support files for this book.
Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.
Errata- 9 submitted: last submission 15 Jan 2013
Errata type: Typo | Page number: 20
$ drush core-status
Errata type: Formatting | Page number: 90
There is a highlighted parehthesis that has to be strikethrough.
Errata type: Code | Page number: 51
$ drush cron
Errata type: Other | Page number: Back Cover
At the end of the second paragraph, where it says "- by simply using the line command." it should say "- by simply using the command line."
Errata type: Others | Page number: Back Cover
Most tasks for building and maintaining a website are repetitive, but most of these tasks can be achieved with a single Drush command, drastically shortening the development and maintenance time of a project.
Most tasks for building and maintaining a website are repetitive, but these tasks can be achieved with a single Drush command, drastically shortening the development and maintenance time of a project.
Errata type: code | Page number: 62
so it won't get blocked. Defaults to 2 years ago. Accepts
so it won\'t get blocked. Defaults to 2 years ago. Accepts
Errata type: Technical | Page number: 28
Two paths are wrong in the bullet list that goes below the paragraph that starts with "Now, we are going invoke the Drupal installation process...".
The sites/all/settings.php file configured and pointing to a database Has the wrong path.
It should be "default" instead of "all" so it would be: The sites/default/settings.php file configured and pointing to a database
The sites/all/files directory ready to be used by the website has the same mistake.
It should be: The sites/default/files directory ready to be used by the website
Errata type: code | Page number: 63
the 'Arguments' should read:
languages A list of languages to filter user accounts.
roles of roles
Note that you have to wrap a role between quotes if it has a space in its name.
Errata tpye: Code | Page number: 53
$ mdkir backups
$ mkdir backups
What you will learn from this book
- 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.
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.
A practical guide full of examples and step-by-step instructions to start using Drush right from chapter 1.
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.