2

I have an existing Drupal 6 site. We've completed development but we're told it needs to be added to a multisite setup which involves moving key files and modules to different directories. Can someone please give me a few tips on how to do this or point me to a tutorial?

EDIT: would it be easier to rebuild the site from scratch (ouch) or to make the changes to the existing site? Any help would be appreciated!

  • 1
    Not answering b/c I have never done this, but keep in mind that paths are stored a few places in the database. Off the top of my head, there is the systems and files tables, and there is also the possibility that there may be some in body and other fields as a result of Insert. Paths may also end up in the variables table in some cases. – mpdonadio Nov 14 '11 at 21:47
  • Thanks MPD, I guess this won't be the easiest thing one can do to a Drupal website either. I only wish we had been told right from the outset... :-( – Jane Nov 14 '11 at 21:55
3

Not a complete guide, but here are some hints.

  • In general, modules aren't a problem, Drupal can deal with it if you move them around. Just do a cache clear after moving them and Drupal will go out and look for the enabled modules in all possible places (mainly sites/all/modules and sites/yoursite/modules). Make sure that you have no hardcoded path in your modules (contrib modules probably don't, but maybe custom ones), always use drupal_get_path() and similar functions.

  • You can do a big part of the multi-site conversion in your existing site, just rename the default folder to yoursite.com. Note that you need to execute drush commands within that order or use the -l argument from then on, if you use drush.

  • You probably want to move modules from sites/all/modules to sites/yoursite.com/modules in a first step (see first point). The existing site will probably have modules in sites/all/modules, you can then download them to your local site. Note that modules in sites/yoursite.com/modules override those in sites/all/modules. Then, figure out which modules are common, note that downgrades aren't possible, if you used a newer version of a module, you either need to keep it or upgrade the one in sites/all/modules. Make sure to properly test the changes (your site and the existing multi-sites, if you change anything in sites/all/modules). Same game for themes.

  • The main issue will probably be file links in the files table, which you will need to change if your previous public path was in sites/default/files. If you already do the multi-site switch locally, you can again do and test this locally. Luckily, this has improved in D7, which doesnt't store the actual file path but something like public://the_file.jpg.

  • It is possible to share some tables, for example the users table, by having a single database for all sites and use a common prefix for some tables and a different one for others. If that's the case, you're in for some work (as you will need to rename all separated tables and merge the content of the shared ones). But it should be doable.

  • If you have hardcoded path's in your nodes and other content, you'll probably need to update them manually. You might be able to write a script that does it, but that could be tricky, dependin on how the path looks exactly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.