Drush Make theory for happy profile development

Basic Theory:

Drush make in the world of real profile development requires an understanding of a couple of basic concepts. The first concept is to understand that you have an essential need for no less than 2 make files. The "stub" make file, and your profile's make file. These together allow easy creation and distribution of light weight essential building blocks for your profile.

The Stub Make File:

The "stub" make file is a very simple construct. It references exactly two things. First it references the core version of Drupal you intend on using, and second it references the profile you intend on bundling with your distribution. There's an easy win here as well if you intend on bundling multiple profiles with your distribution. A perfect example of this could be an aegir platform.

Example stub make file

; make file for drupalorg_testing profile
core = 6.x
projects[] = drupal
api = 2

; Profile.

projects[drupalorg_testing][download][type] = "git"
projects[drupalorg_testing][download][module] = "drupalorg_testing"
projects[drupalorg_testing][download][branch] = "master"

How to Upgrade Drush

Ref: See http://docs.drush.org/en/8.x/install/
Drush is completely independent of your Drupal installation(s).

To update it to a later version, follow the same instructions as initial installation, and simply place the new version of Drush in place of the old.

Windows XP / Windows 7

The article "How to manually upgrade to Drush 5.x and 6.x on Windows XP and 7" provides instructions for manually upgrading to the latest development version of Drush in Windows. The instructions have been tested on Windows XP and Windows 7.

Linux

Note: If you already have Drush installed, you can simply run drush dl drush for it to download itself.

Applying the destination you can install Drush in the location you desire. E.g. In most Linux distributions:

sudo drush dl drush --destination='/usr/share'


Note: Do not run the update command from the same directory where drush is installed or you will get an error (cannot create directory), e.g. do not run the above command from the /usr/share/drush directory. You CAN run it from the /usr/share directory (per the above example).


Suggestion: To avoid accidentally destroying your 'aliases.drushrc.php' if you are using one, put that file in '.drush' or '/etc./drush' and NOT in your drush directory.

Other solutions (mileage may vary):

Drush FAQ - outdated

NB! This page is no longer maintained. Please read the officially documentation located at drush.org.


There is a lot of information about drush in various places around drupal.org and elsewhere; this page is an attempt to pull some of it together.

Using drush to synchronize and deploy sites

Important:
This document reflects drush-3.0-beta2 and later versions.

Editor's Note
At the time of this writing, the most recent drush tag is drush-3.0-beta1, which contains a different implementation of the site alias feature.

Please note that Drush has moved to Github.

Drush has introduced the concept of 'site aliases', which are small arrays containing connection details relevant to individual site instances. These are used to note information about your local dev site and a remote staging site (for example).

With this info, drush can help you move content between these locations!
Illustration of the relationship between servers using drush.
After installing drush, have a look at:
drush help site-alias
drush help rsync
drush help sql-sync
to get started.

You will first want to make a note of your local site alias information.

About the local setup

Drush Make - Drupal Distributions Packaging Automation Tool

Drush Make (as of Drush version 5) is now included in Drush, the command line tool for Drupal (or follow this link to the Drush handbook page for more information on how to use Drush itself).

Drush Make was previously a separate project and had its own separate project page: http://drupal.org/project/drush_make

What Drush Make does is, through the implementation of flat files (similar in appearance to .info files from modules), provide a mechanism to fetch data from practically any source you tell it to, and package it. This includes downloading Drupal core as well as other contributed modules available on drupal.org.
It also provides the ability to fetch:

  • code from git repos, including tag-specific
  • ditto for svn
  • ditto for git, including checking out a particular branch after cloning the repo
  • grabs .tar.gz stuff, wget-style - useful for libraries
  • can fetch and apply patches

The package created can then be used for distribution or as a platform build that can then be deployed and instancified/cloned using the Aegir hosting system.

A typical Drush make file could look something like the following:

my_own_distribution.build

core = 6.x

Drush SQL Query (sql-query, sqlq)

Below you find some examples of how to use the Drush sql-query (alias : sqlq) command.

Show information of user 1:
drush sql-query "SELECT * FROM users where uid=1"

Troubleshooting

error: system() has been disabled for security reasons

To resolve, go to your (local or global) php.ini and temporarily remove 'system' from the disable functions parameter:

Example:

Change
disable_functions = show_source, system, shell_exec, passthru, exec, phpinfo, shell, symlink
To:
disable_functions = show_source, shell_exec, passthru, exec, phpinfo, shell, symlink

Warning: this exposes some security risks, so there must be a better way to do it with PHP, without using the 'system()' function.

Using a custom php.ini
Please see the page Modifying the PHP or PHP configuration that drush runs under for instructions on creating a custom php.ini file for Drush.

Custom version of the php.ini file

You can use something like this to invoke a custom version of the php.ini file you want to use with Drush. The PHP command argument -c ini-file will allow you to specify a custom .ini file to use with Drush.

Pages

Subscribe with RSS Subscribe to RSS - drush