I would like to know if exists a method for using one only locale table (or database) for multiple sites.
Thanks

Comments

killes@www.drop.org’s picture

Sure.

See here: http://drupal.org/node/2622

--
If you have troubles with a particular contrib project, please consider to file a support request. Thanks.

pamphile’s picture

I tried out that Super Advanced Usage.

But when try to add a user I get this error:

user error: Duplicate entry '2' for key 1
query: INSERT INTO script_scriptdiary.users (name, pass, init, mail, rid, status, timestamp, uid, data) VALUES ('yaba', '353tdg35g', 'yaba@01motors.com', 'yaba@01motors.com', '2', '1', '1097034050', '2', 'N;') in /home/script/public_html/includes/database.mysql.inc on line 97.

Any ideas from anyone ?
Do I have to start with a clean database somewhere ?

http://businessletters.com

dries’s picture

If you are sharing the users table, you might have to share the sequences table as well (although I'm not sure). If you don't want to share the users-table, and just want to share the translations, sharing the locale tables should suffice.

Note that using Drupal 4.5.0 (RC) you can export and import translations using a web interface.

pamphile’s picture

I'll try sharing the sequences table and report what happens.

I specifically want to share the user table.

I want all members of a.com and b.com to login using the user database
of everyone.com. I know I can use DA ( distributed authentication ) but DA does not restrict which sites can login.

http://scriptdiary.com - http://01wholesale.com

pamphile’s picture

Thanks Dries, your suggestion worked. I can create accounts from any of the networked sites. Users can use the same username/password throughout the sites.

I'll be testing more features to make sure everything works well.
It's amazing but Drupal is really a tool for world domination. ;)

http://scriptdiary.com - http://01wholesale.com

pamphile’s picture

I also noticed that the roles are shared throughout the network.

Pretty cool ! :)

http://01wholesale.com

yuit’s picture

Dries,

I am still using the 'production' version 4.4.2 of Drupal. I was until today using multiple Drupal sites with a single database with success, sharing a number of tables including the 'sequences' one.

I now have a situation where I need to share tables across 2 databases, the shared tables being in a different one. I have added the following in the relevant conf.php file :

$db_prefix = array(
"default" => "",
"users" => "db2.",
"sequences" => "db2."

where 'db2' is the other database hosting the shared 'sequences' table.

Unfortunately it does not work. When I try to add a user, I get an error message. When opening the 'sequences' table in 'db2', I see that a new line was created where the 'name' field reads:

db2.users_uid

It looks like in this situation where the shared 'sequences' table is in a different DB, a new record is added which shows the DB prefix, instead of using and incrementing the main 'users_uid' record in the table.

I am not sure if this has already been corrected in 4.5RC, but you may wish to have a look at this issue when you're finished with more urgent issues :-)

pamphile’s picture

what error msg are you getting ?

http://01ftp.com

cetron’s picture

1

cetron’s picture

solved. Now I have one locales database shared with multiple sites.
And I am looking for other tables to keep in the shared database...
Thanks

I tried to edit the last post but I got a '1'.

pamphile’s picture

Pretty cool isn't it ?

I was got the same editing issues with another post within this thread. Not sure why...

Marcel
http://scriptdiary.com

cetron’s picture

Now Drupal is working with three databases, one with the locales table and two databases for two sites.
It works, but I have to 'refresh' the translation already made, for being able to see the changes in the other site.
It has something to do with the cache system? do I have always to re-save the translation in the other site to make it work?
thanks.

cetron’s picture

I loaded the database of the other site without any content in the cache table, then the translation worked.
Nevertheless, I was logged as superuser, and cache was working. Even disabled. It seems that some design is missing between the locales and the cache system. Is there some way to disable cache? I am using Drupal 4.4.2, it this solved in 4.5.0? please help.

killes@www.drop.org’s picture

You can disable caching in the admin settings page. As an alternative you can clear the cache table from phpmyadmin or mysql.

--
If you have troubles with a particular contrib project, please consider to file a support request. Thanks.

cetron’s picture

When loading the page the first time after cleaning cache, even with cache disabled in the admin settings, this table is loaded with content from locales table. Cache is used even when disabled for locales contents.
I don't know how the cache and locales are related, but a workaround for this feature would be cleaning the cache for all sites after a translation session was done, for updating it with new contents.

killes@www.drop.org’s picture

The locale is cached all the time, that's right. Without the cache the locale system would be very slow. I am afraid there is no way that the cache table of the other site can be cleared after doing a new translation. I suggest to use PO files for doing translations. Then you can upload all strings once and clear all cache tables once manually.

--
If you have troubles with a particular contrib project, please consider to file a support request. Thanks.

pamphile’s picture

Clearing the cache will get rid of old pages which reference another domain or config/setup. :)

Marcel
http://01community.com

cetron’s picture

Now I have a common database with only the locales table shared across two sites. But ...
The locale to be translated needs its translation to be updated (re-saved) on the other site in order to reflex the changes.
Cache is disabled for both sites, do I need another shared table?

harald.walker’s picture

I also want to use one database for several sites. Three reasons for this.

  • some articles (not all) should appear on multiple sites
  • share resources (images, movies)
  • central point for maintainance

I read the various pages about this subject but it didn't talk about the content and how to structure and display it per site. So e.g. how can I define per site, where to start in the taxonomy tree? This way the top categories could be equal to the domains, while the site's menu is the next level/branch.

pamphile’s picture

IMHO there is no way of associating a Domain with a taxonomy term - unless you modify the code yourself.

I don't know how to do it, but this is what should be done. Maybe in 4.6 RC ?

You need to:
1. Associate a domain with each taxonomy term.
- Like that the nodes within the term are given a domain.

2. Associate a starting/root taxonomy term for each domain.
- So when you get to the domain homepage, you would know what starting taxonomy terms to display.

3. Hack the Code so each time a term and node is mentioned, the correct domain is displayed.

That's all...

http://scriptdiary.com
http://01classifieds.com

pamphile’s picture

I added a feature request for this:

http://drupal.org/node/11399

Marcel
http://scriptdiary.com

Alexandre Gomes@ensaio.jor.br’s picture

I suppose there are a easy way to do this.
Just share all tables except configurations and cache with many settings.php, one for each domain.
For each domain set the front page (/admin/setting) for the page of the desired taxonomy. Set in themes config (/admin;themes) the primary and secondary links to links using the desired taxonomy terms.
Now the search cover all content, but the front page, base url, site name, slogan, mission, are diferent.

harald.walker’s picture

I just tried the following tonight:

In conf.php I define $db_prefix and $base_url based on $_SERVER['HTTP_HOST']. I am still trying to figure out, which tables should be separated per domain. Looks like 'menu' and 'system' should be enough. This way I can define the menu structure and some system settings (e.g. template) per domain. Well, it didn't seem to work. Looked like the prefix hasn't been used or maybe other tables also have to be used. I used the prefix array method as described on http://drupal.org/node/2622
Since I messed up my Drupal installation with the experiments, I will have to fix the database before I can continue.

killes@www.drop.org’s picture

Each site also needs its own cache and variables table.

--
If you have troubles with a particular contrib project, please consider to file a support request. Thanks.

harald.walker’s picture

That helped. Got different templates etc. per domain running now. Had a problem with the menu but emtying the cache table fixed that.

pamphile’s picture

It's always a good idea to backup before making these changes.

Marcel
http://01community.com

harald.walker’s picture

I want to migrate 3 existing (plus one new) sites from normal static/php pages to one Drupal CMS system. Will prepare it on a local intranet server and then transfer the database and go live. I still have to learn a lot about Drupal, create my own templates and migrate all of the content. By then 4.5 should also be final.