Skip to content

Instantly share code, notes, and snippets.

@antillas21 antillas21/sites.php
Created Apr 16, 2012

Embed
What would you like to do?
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
You can’t perform that action at this time.