| | Members: 16,816 Threads: 38,941 Posts: 160,344 Online: 184 Newest Member:
Dirk Ahlemeyer | | | |  |  | |  |
15.04.2004, 07:05
|
#21 (permalink)
| | Expert Mamber
Join Date: Apr 2004 Location: Virginia Beach, Virginia USA
Posts: 309
| Re: Multiple Mambo sites It would probably make sense to expand on Tom's orginal all_ table approach to handle a single set of ACL tables for all sites.
If a boolean variable was added to configuration.php, 0 could be evaluated as single site operation and 1 could be evaluated as multisite operation. This could be used to handle cases where a mix of single site and multisite installations existed in the same database.
Then the boolean value could be used in a switch statement with multiple case clauses to determine if a site used its native #__users/ACL tables or a pooled set of all_ tables. Quote: |
Originally Posted by tonyskyday Then how would you handle user registration updates? Such as password changes? Also, you'd have to change admin.registration.php as well I would think.
-Tony | |
| |
15.04.2004, 09:34
|
#22 (permalink)
| | Expert Mamber
Join Date: Apr 2004 Location: Virginia Beach, Virginia USA
Posts: 309
| 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. |
| |
15.04.2004, 09:48
|
#23 (permalink)
| | Expert Mamber
Join Date: Apr 2004 Location: Virginia Beach, Virginia USA
Posts: 309
| Re: Multiple Mambo sites Ready... we need to do something about the cookie. With the above, you can switch back and forth between multiple sites, but lose the login if you switch to a dedicated site (non-multisite installation) and then return to one of the multisite installations.
To handle this, there needs to be a configuration option for setting unique ids for a site's cookie. If done, this should solve the problem because the multisite installations and dedicated site installations could have different cookies.
Anyone know where the cookie code is stashed? |
| |
15.04.2004, 10:07
|
#24 (permalink)
| | Expert Mamber
Join Date: Apr 2004 Location: Virginia Beach, Virginia USA
Posts: 309
| Re: Multiple Mambo sites In mambo.php in the _setConfig function, the parameter definitions in configuration.php are loaded and reloaded as needed. Around line 273, the following two lines should probably be added under db_prefix to assure that the variable definitions are loaded. PHP Code: $this->_config->dbprefix = $mosConfig_dbprefix;
$this->_config->users_dbprefix = $mosConfig_users_dbprefix;
The cookie code is in mambo.php. I'm looking at this now. |
| |
15.04.2004, 11:20
|
#25 (permalink)
| | Expert Mamber
Join Date: Apr 2004 Location: Virginia Beach, Virginia USA
Posts: 309
| Re: Multiple Mambo sites The above is not a complete solution. When changes are made to Global Configuration, the configuration.php is either rewritten or replaced. Need to find the code where this occurs to make sure the two parameters are included in the revised file. |
| |
15.04.2004, 11:55
|
#26 (permalink)
| | Baby Mamber
Join Date: Apr 2004
Posts: 22
| Re: Multiple Mambo sites Just popped back over...
Nice work!
I like how you tied the sessions in also
I spent some time chatting with a friend of mine who has agreed to look it over. Basically I am trying to accomplish what you have done above but allow for each of the multi-sites to have their own distinct permission/group list.
For Example Ted could be a:
Super Admin on Site A
Registered User on Site B
Author on Site C
I really appreciate the help MMX
I noticed the configuration.php would write out the addional changes also last night. I just resigned to editing it myself and uploading it. |
| |
15.04.2004, 12:00
|
#27 (permalink)
| | Expert Mamber
Join Date: Apr 2004 Location: Virginia Beach, Virginia USA
Posts: 309
| Re: Multiple Mambo sites This is silly because I'm talking to myself.
The solution for the above was to modify administrator/components/com_config by adding a field and code for the user table prefix (sets $mosConfig_user_prefix and was added below the site prefix) and a select list for enabling multisite (updates $mosConfig_multisite and was added just above GZip Compression). This allows MOS to update configuration.php when Global Configuration changes are made; otherwise, the two new definitions are not written when the file is updated. |
| |
15.04.2004, 12:11
|
#28 (permalink)
| | Expert Mamber
Join Date: Apr 2004 Location: Virginia Beach, Virginia USA
Posts: 309
| Re: Multiple Mambo sites Modified com_config is attached.
Ready... test this to see if it works on your setup. |
| |
15.04.2004, 12:30
|
#29 (permalink)
| | Expert Mamber
Join Date: Apr 2004 Location: Virginia Beach, Virginia USA
Posts: 309
| Re: Multiple Mambo sites Quote: |
Originally Posted by Ready Just popped back over...
Nice work!
I like how you tied the sessions in also
I spent some time chatting with a friend of mine who has agreed to look it over. Basically I am trying to accomplish what you have done above but allow for each of the multi-sites to have their own distinct permission/group list.
For Example Ted could be a:
Super Admin on Site A
Registered User on Site B
Author on Site C
I really appreciate the help MMX
I noticed the configuration.php would write out the addional changes also last night. I just resigned to editing it myself and uploading it. | It's probably possible to build a component based on Tom's original idea. Since at least one of the modified files (mambo.php) is also modified for Alex Kempkin's Mambelfish, there should be some discussion about this. That is, whether or not to merge this code with Mambelfish (which Alex might prefer because he needs a multisite fix for something else) or optionally install a modfied mambo.php if Mambelfish is already installed on users systems. To handle this properly, Mambelfish probably needs the same smarts.
If we do a component, it's possible to do what you want regarding permissions but it means finishing off the incomplete phpGACL implementation. That adds a big can of worms because it really should be handled in a separate thread. There is miles of feedback in other threads located all over the place about what the ACL permissions should and should not do. Otherwise, hookup with Travis Swicegood and integrate his earlier authentication/acl work into whatever comes of this. |
| |
15.04.2004, 13:49
|
#30 (permalink)
| | Expert Mamber
Join Date: Apr 2004 Location: Virginia Beach, Virginia USA
Posts: 309
| Re: Multiple Mambo sites The #__groups table can be all_groups to eliminate another table. 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('#__groups', $this->_user_table_prefix.'groups', $sql);
$sql = str_replace('mos_groups', $this->_user_table_prefix.'groups', $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 );
}
}
|
| | | Thread Tools | | | | Display Modes | Linear Mode |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | All times are GMT +2. The time now is 06:34. | | | |