Single Site to Multi-site Conversion Tips

As discussed on the Drupal basics page Drupal is made up of three main parts, the codebase, the upload files and the database. In order to migrate to a multi-site set up all three of these parts of Drupal may need to be changed.

Code Base Alterations

This pretty much follows the examples outline in the multisite guidelines. Any module or theme not included in the standard list will need to be added to your subsite.

Uploaded File Alterations

The files directory is usually the simplest part of this change. Move the files sorted in {drupal_install}/sites/default/files to {drupal_install}/sites/mysite.ucsf.edu/files.

Example

I have a site mcmanuslab.ucsf.edu which has been storing it's files in the default site, so all the files need to be moved to sites/mcmanuslab/files. Unix command follows:

mv $DRUPAL_HOME/sites/default/files to $DRUPAL_HOME/sites/mcmanuslab.ucsf.edu/files

Database Alterations

Most of the changes will require the following SQL

First Example

update `files` set filepath = replace(filepath,'sites/default/files/','');

The above example replaces 'sites/default/files' with nothing ''.

Second example (used converting a single site set up to multi-site)

update `files` set filepath = replace(filepath,'sites/default/files','sites/mcmanuslab.ucsf.edu/files');

The above example replaces "sites/default/files" with 'sites/mcmanuslab.ucsf.edu/files'

Changes you will most likely need to make

  1. Change the path of filepath in the files table. The above example shows this exact change.
  2. Change the path of picture in the user table. Again follow the example above, substituting user for files and picture for filepath 
  3. Change the path of body in the node_revisions table.  Yup still use the formula above, this time subsitute node_revision for files and body for filepath.

Other places to check

  • views

After you upload to the Multi-site server

Make sure to change file settings they can usually be found at http://mysite.ucsf.edu/admin/settings/file-system

The fields you need to change is File system path