multi-site /single-db installation: each site erases the other sites' site-only themes when accessing the Administration -> Site-Building -> Themes page

CommentFileSizeAuthor
#3 INSTALL_txt.patch4.8 KBjastern
Screenshot_forget_theme.png81.63 KBjastern

Comments

jastern’s picture

we have a multi-site installation of drupal 6.4 on a linux (fedora 8) box, stored at /var/www/dru/. all sites share the same database (i.e., no database prefixing). this is because we want them to have different looks/feels/URLs, but share the same news/events data and other content.

the setup is similar to the following (with site names changed to protect the culprits).

first, there are virtual hosts set up in our apache httpd.conf file:

...

NameVirtualHost *:80

<VirtualHost *:80>
  ServerName sitea.com
  DocumentRoot "/var/www/dru"
</VirtualHost>

<VirtualHost *:80>
  ServerName siteb.com
  DocumentRoot "/var/www/dru"
</VirtualHost>

second, each site has its own directory, with its own settings.php file and its own theme. notice that these themes are under the sites' themes folders, not under /var/www/dru/themes or /var/www/dru/sites/all/themes.

  /var/www/dru/sites/sitea.com/
                               settings.php
                               themes/
                                      sitea_theme/
  /var/www/dru/sites/siteb.com/
                               settings.php
                               themes/
                                      siteb_theme/

the important part of each site's settings.php file are the following lines:

$db_url = 'mysql://thewizard:oz@emeraldcity.com/bagofgoodies';
$base_url='http://sitea.com';
$conf['theme_default'] = 'sitea_theme';

for sitea.com and

$db_url = 'mysql://thewizard:oz@emeraldcity.com/bagofgoodies';
$base_url='http://siteb.com';
$conf['theme_default'] = 'siteb_theme';

for siteb.com so that they are using the same database, but using their own URLs and themes.

now, accessing sitea.com/admin/build/themes via web browser causes siteb.com to loose its theme.

conversely, accessing siteb.com/admin/build/themes via web browser causes sitea.com to loose its theme.

thus, administering themes from any one site's URL breaks the other sites (causes them to lose their theme).

the screenshot captures what the broken sites look like right after another site has accessed its own /admin/build/themes page.

with a little investigating, i found that what seems to be happening is that the drupal mysql "system" table gets cleared of all the other sites' themes each time the /admin/build/themes page is accessed from a site (don't even have to click on the "Save Configuration" button). each site lists out only its own site-specific themes, erases all the others, and populates the table only with themes common to all sites, plus those themes under its own themes folder -- thus breaking the other sites.

thus, accessing the themes admin page via the sitea.com URL deletes the entry in the mysql system table for siteb.com's theme, and accessing the themes admin page via the siteb.com URL deletes the entry in the mysql system table for sitea.com's theme.

this means that it is currently not possible to have a multi-site installation with a shared database, but different themes where the themes are stored under each site's theme/ directory.

the way we have gotten around this problem for now is to store all themes under /var/www/dru/sites/all/themes/. but the downside to this is that all themes for all sites will appear as choices when administering at any one site's /admin/build/themes page. and, of course, the themes/ subdirectory of each site is now useless.

please let me know if there is anything else you need to know, or any information i have left out.

thanks.

boris mann’s picture

Status: Active » Closed (works as designed)

What you're doing is not supported -- that is, one single database but separate settings files. I understand what you want to do, but this is not the way to do it.

You want the domain access module: http://drupal.org/project/domain

jastern’s picture

Component: theme system » base system
Status: Closed (works as designed) » Needs review
StatusFileSize
new4.8 KB

okay, thanks for the information, boris. that is quite helpful. since this is "by design", but is not mentioned in the INSTALL.txt, i've added a potential patch to drupal 6.4's INSTALL.txt file with the information you provided in Comment 2, in the hopes of saving other people the time i lost trying to figure this out. i've also added some clarifying text on VirtualHosts and the construction of the settings.php files.

let me know if there's anything else you need, and thanks again.

damien tournoud’s picture

Component: base system » theme system
Priority: Critical » Normal
Status: Needs review » Active

Well, this *should* be supported, but is not because of the visibility issue you encountered. A specific Drupal site cannot guess that several sites share the same {system} table, so it currently drop every theme that it cannot see.

I think we should educate system_theme_data() not to remove themes that are outside its search scope.

By the way: it works for modules because module_rebuild_cache() is implemented differently. Some think that's a bug (see #289369: Deleted modules are not removed from system table).

Anonymous’s picture

Status: Active » Closed (works as designed)

Read over the multi-site part. My apologies.

Anonymous’s picture

Status: Closed (works as designed) » Active

Can you set databases prefixes in multi-site? If yes, then this should be closed. It's logical that you're having these problems. You should really use prefixes, if you can, and only share those tables which can be shared. There are topics and articles on how to do this.

pingers’s picture

Status: Active » Closed (works as designed)

Of course you can... closing.
(Yay, bug bingo)