Skip to content

Instantly share code, notes, and snippets.

@antillas21
Created April 16, 2012 21:23
Show Gist options
  • Save antillas21/2401607 to your computer and use it in GitHub Desktop.
Save antillas21/2401607 to your computer and use it in GitHub Desktop.
Steps to take Drupal site out of multi-site install
<?php
$sites = array(
'sitename.com' => 'sitename.com',
// the first sitename.com in the file, refers to the url content in the browser's window,
//you may/probably should replace this with a FQDN.
// the second sitename.com appearing after '=>' is the directory name inside sites/ where
//the site files are stored.
);
# SSH into development server, cd into Drupal platform install directory and do:
$ drush ard sitename.com --destination=~/site-backup-filename.tar.gz
# Move site-backup-filename.tar.gz into the production server
# SSH into production server, cd into Apache document root and issue:
$ drush arr site-backup-filename.tar.gz --db-url=mysql://dbuser:dbuserpasswd@dbhost/dbname
# This will restore the sitename.com directory inside a full Drupal install taken from
# the development server's platform, e.g. drupal-7.10-x
# Change owner for the whole Drupal directory:
$ chown -R www-data:www-data drupal-7.10-x
# Just in case, also issue the same command for the following directories:
$ chown -R www-data:www-data sites/sitename.com/files
$ chown -R www-data:www-data sites/sitename.com/private
$ chown -R www-data:www-data sites/sitename.com/private/temp
# Create sites/sites.php file with the content from sites.php in this gist:
$ touch sites/sites.php
# Or you can just symlink sites/sitename.com to sites/default to emulate a clean Drupal install:
$ ln -s sites/sitename.com sites/default
# Just to be completely sure, remove anything from sites/sitename.com/settings.php
# that is not db related, when the site is restored, drush appends the new db settings
# to this file, so pretty much what's before this new db declaration is "useless".
# Issue several times:
$ drush cc all
# just to be sure we cleared all cache from this new install...
# remember to do this inside sites/sitename.com directory.
# in case you forgot to check permission (specially in CentOS and Enterprise built servers)
# remember to issue inside the Drupal install directory:
$ find . -type d -exec chmod 755 {} \;
$ find . -type f -exec chmod 644 {} \;
$ chown -R [apache/nobody]:[apache/nobody] .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment