drush

Introducing Devit

Devit Admin
You have a live website and you need to copy a fresh version of the (live) database onto your local machine for development. Next, you need to run through one or more of these rote tasks:

  • Disable Drupal core caches (page cache, block cache, CSS & JS optimization, etc.)
  • Sanitize user data
  • Update Drupal's file system paths (public, private, tmp directories)
  • Enable email rerouting
  • Update logging and error level settings
  • Re-configure a contrib module. E.g., Secure Site (enable, set permissions, guest accounts).

Does this sound familiar? If so, I have good news! I've created a module that will help you automate that process.

Migrating a Drupal site between servers via Drush

As of Drush 4.5, migrating a Drupal site between servers became much easier. The new, little-known drush archive-dump and drush archive-restore commands make it an essentially three step process.

Overview

A basic Drupal site is made of two fundamental elements: the codebase and the database. When you migrate a Drupal site, you need to migrate both of these elements, often with a bit of re-configuration to boot.

The Old Way

Before using Drush to migrate a site, my standard procedure for site migration looked something like this:

Database Migration

Setting up Drush on Siteground's shared hosting environment

Just a quick note to other siteground users with ssh access to their shared hosting accounts: Drush can work via the command line in a siteground environment. Here are some specific settings that I had to include to get it to work:

~/.bashrc:

alias drush='/usr/local/php52/bin/php-cli ~/drush/drush.php --php=/usr/local/php52/bin/php-cli'

~/.bash_profile

PATH=$PATH:~/home/[myuser]/drush:$HOME/bin

You might want to check your particular shared hosting environment to ensure that the selected PHP version is not using fast-cgi, that seemed to cause problems for me with drush. Luckily, Siteground makes multiple versions of php available to its users. If you're having trouble, you can just take a look at the /usr/local directory and pick a different version of PHP

Drush - too many levels of recursion

I'm a total linux noob. So when I tried to manually set up Drush on a Linux server today, I ran into a bit of trouble. Following the Drush instructions, I put drush outside of the webroot and attempted to create a symbolic link between the Drush directory and /usr/bin.

The drush readme instructs a noob to do the following:

ln -s /path/to/drush/drush /usr/bin/drush

So, I navigated to the drush directory and tried to follow instructions:

cd /var/www/drush
ln -s drush /usr/bin/drush

Attempting to run Drush then gave this error:
bash: /usr/bin/drush: Too many levels of symbolic links

After a lot of fruitless Google searching, I decided to try again with a closer attention to detail:

Subscribe to RSS - drush