published by Fonant on Mon, 2009-02-09 10:14
Copying a complete Drupal site to a new virtual site within the same Drupal installation is relatively easy. These are the steps to take:
- Take original site off-line to prevent changes while the copy is in progress.
- Copy site-specific files, themes and modules.
- Copy the site database (with phpMyAdmin select "Add AUTO_INCREMENT value" for this to work properly).
- Return original site to on-line state.
- Log into new copy and visit these admin pages:
- Modules (updates the database with the new sites module paths)
- Themes (updates the database with new site's theme paths)
- Theme configuration if the theme's colours or logos etc. were configured.
- Edit the
files
table to point the filepath
column entries to the files in the new location. Suitable SQL would look like:
UPDATE files SET `filepath` = REPLACE(`filepath`, 'oldpathpart', 'newpathpart') WHERE `filepath` LIKE '%oldpathpart%';
- Return the new site to on-line state.
You might also need to empty the cache tables (use the Devel module, or phpMyAdmin) - this needs further testing, it might be unnecessary given the steps above.