View Single Post
Old 15.04.2004, 10:34   #22 (permalink)
mmx
Expert Mamber
 
Join Date: Apr 2004
Location: Virginia Beach, Virginia USA
Posts: 309
mmx is on a distinguished road
Send a message via MSN to mmx
Default Re: Multiple Mambo sites

Quote:
Originally Posted by Ready
yeah.. looking at the admin now... hmmmmm....

We would still share the user table and make alterations to where it writes to the db on registration... maybe....
Ready... Try the following:

Replace setQuery with:

PHP Code:
    function setQuery$sql$prefix='#__' ) {
        
        if (!(
$mosConfig_multisite=0)) {
            
/* Tom: substitute the prefixes that point to the users table with the central user table prefix */ 
            
$sql str_replace('#__users'$this->_user_table_prefix.'users'$sql);
            
$sql str_replace('mos_users'$this->_user_table_prefix.'users'$sql); 

            
$sql str_replace('#__session'$this->_user_table_prefix.'session'$sql);
            
$sql str_replace('mos_session'$this->_user_table_prefix.'session'$sql); 

            
$sql str_replace('#__core_acl_aro'$this->_user_table_prefix.'core_acl_aro'$sql);
            
$sql str_replace('mos_core_acl_aro'$this->_user_table_prefix.'core_acl_aro'$sql); 

            
$sql str_replace('#__core_acl_aro_groups'$this->_user_table_prefix.'core_acl_aro_groups'$sql);
            
$sql str_replace('mos_core_acl_aro_groups'$this->_user_table_prefix.'core_acl_aro_groups'$sql); 

            
$sql str_replace('#__core_acl_aro_sections'$this->_user_table_prefix.'core_acl_aro_sections'$sql);
            
$sql str_replace('mos_core_acl_aro_sections'$this->_user_table_prefix.'core_acl_aro_sections'$sql); 

            
$sql str_replace('#__core_acl_groups_aro_map'$this->_user_table_prefix.'core_acl_groups_aro_map'$sql);
            
$sql str_replace('mos_core_acl_groups_aro_map'$this->_user_table_prefix.'core_acl_groups_aro_map'$sql); 

            
/* Tom: end edit */ 
            
$this->_sql str_replace$prefix$this->_table_prefix$sql ); 
        } else {
            
$this->_sql str_replace$prefix$this->_table_prefix$sql ); 
        }
    } 
Add a new variable to configuration.php:

PHP Code:
$mosConfig_multisite '1'//mmx: flag determines if installation is single site or multisite 
Set this variable to '1' for any site that needs to use the all_ prefixed tables and to '0' for any sites that are not multisite (dedicated sites).

With this configuration, you want to leave the $mosConfig_users_dbprefix set using the same prefix as the site's parent tables only if that site exists in the database and it is not a member of a community of sites (multisite). For example, if site1 and site2 are multisite, $mosConfig_users_dbprefix should be set to all_, but if site3 is a dedicated site, be sure to set the variable to the same prefix as the default prefix for the dedicated sites.

For multisite access to common tables, change the prefix of the following tables to all:

all_core_acl_aro
all_core_acl_aro_groups
all_core_acl_aro_sections
all_acl_groups_aro_map
all_session

I have not tested the above with logging enabled and it needs to be done. You might try that to see if there are any problems. If so, the core logging tables may also have to be considered in the above code.

The use of all_session allows the login between multiple sites to be passed on to other sites in the multisite community.

You want to leave the above tables intact with the parent prefix for any sites that are not members of a multisite community.

There are a few other tables that we might want to have prefixed with all_ on a conditional basis if they exist (i.e mos_help).

Try the above and let me know if you have any problems. I only tested switching between sites that were multisite and not multisite within the same database. Some other problems could show up with various components.
mmx is offline   Reply With Quote