1
reynaldo
TRUE Multisites hack.... at last!
  • 2004/2/15 6:47

  • reynaldo

  • Not too shy to talk

  • Posts: 106

  • Since: 2004/2/13


I'm working on a TRUE multisites hack for Xoops.
Currently I'm testing it on my sites to make sure it is error free before releasing it.

What I mean for "TRUE" is that you are able to share only those tables you want to share, you no longer have the share all/none situation.

This hack is so simple yet so powerful you only have to edit two files to make it work.

Keep checking and post any ideas you may have, I'll post the download link as soon as I'm sure everything is working as expected.

Now some keywords to make sure everybody looking for multisites help get to this post, LOL:
[size=xx-small]multisites, multi sites, multisite, multi site, multi-sites, multi-site, multiple site, multiple sites.[/size]

2
Mikhail
Re: TRUE Multisites hack.... at last!
  • 2004/2/15 7:00

  • Mikhail

  • Just can't stay away

  • Posts: 412

  • Since: 2003/1/19


Quote:

reynaldo wrote:
I'm working on a TRUE multisites hack for Xoops.
Currently I'm testing it on my sites to make sure it is error free before releasing it.

What I mean for "TRUE" is that you are able to share only those tables you want to share, you no longer have the share all/none situation.

This hack is so simple yet so powerful you only have to edit two files to make it work.

Keep checking and post any ideas you may have, I'll post the download link as soon as I'm sure everything is working as expected.


im running 5 diferent sites with the same users, same files, sabe db, diferent subdomains,... is easy: just edit some lines in "mainfile.php" and "database.php"...

Quote:

Now some keywords to make sure everybody looking for multisites help get to this post, LOL:
[size=xx-small]multisites, multi sites, multisite, multi site, multi-sites, multi-site, multiple site, multiple sites.[/size]

[/quote]


3
reynaldo
Re: TRUE Multisites hack.... at last!
  • 2004/2/15 7:11

  • reynaldo

  • Not too shy to talk

  • Posts: 106

  • Since: 2004/2/13


Quote:
im running 5 diferent sites with the same users, same files, sabe db, diferent subdomains,... is easy: just edit some lines in "mainfile.php" and "database.php"...


Mikhail:

Those are specifically the two files I had to edit :)

Would you mind posting which lines you have to add/modify in order to get it to work, or the url where you found the info?

I decided to do this hack myself as I couldn't find any resource explaining this.

4
davidl2
Re: TRUE Multisites hack.... at last!
  • 2004/2/15 11:56

  • davidl2

  • XOOPS is my life!

  • Posts: 4843

  • Since: 2003/5/26


This is very exciting indeed!

I have actually recently done this by accident - using 1 database across two sites... except only with the same information on each (I accidently left a database pointing to the same location on both sites!)


5
Herko
Re: TRUE Multisites hack.... at last!
  • 2004/2/15 12:00

  • Herko

  • XOOPS is my life!

  • Posts: 4238

  • Since: 2002/2/4 1


Can you send me the code changes please? I'll have our developers take a look at them

Herko

6
Mikhail
Re: TRUE Multisites hack.... at last!
  • 2004/2/15 13:19

  • Mikhail

  • Just can't stay away

  • Posts: 412

  • Since: 2003/1/19


OBS:
IS JUST AN EXPERIMENTAL HACK,
IT IS NOT THE IDEAL WAY TO DO A "XOOPS MULTISITE".


database.php
function prefix($tablename='') {
if ( 
$tablename == '' ) {
return 
$this->prefix;
}
elseif ( 
$tablename == 'users' ) {
return 
'same_users';
}
elseif ( 
$tablename == 'groups_users_link' ) {
return 
'same_groups_users_link';
}
elseif ( 
$tablename == 'priv_msgs' ) {
return 
'same_priv_msgs';
}
elseif ( 
$tablename == 'session' ) {
return 
'same_session';
}
else {
return 
$this->prefix .'_'$tablename;
}
}




to use the same files with diferent sites/subdomains, just replace the mainfile.php for:
if (!(isset($subdominio))) {
$subdominio $HTTP_HOST;
$subdominio str_replace("www.","",$subdominio); 
$subdominio str_replace(".com","",$subdominio); 
$subdominio str_replace(".net","",$subdominio); 
$subdominio str_replace(".org","",$subdominio);


if (!(empty(
$subdominio))) {
include(
$subdominio."mainfile.php");
}
?>



7
reynaldo
Re: TRUE Multisites hack.... at last!
  • 2004/2/20 5:35

  • reynaldo

  • Not too shy to talk

  • Posts: 106

  • Since: 2004/2/13


It's interesting we arrived at the same solution with different code

My code is just a little different from yours:

Database.php:
function prefix($tablename='')
{
    
$myCommonTables = array('avatar''avatar_user_link''online''priv_msgs''stories''topics''users');
    
$myPrefix '';
    
    if (
in_array($tablename,$myCommonTables))
    {
        
$myPrefix 'xoops';
    }
    else 
$myPrefix $this->prefix;


    if ( 
$tablename != '' 
    {
        return 
$myPrefix .'_'$tablename;
    } 
    else 
    {
        return 
$myPrefix;
    }
}


As I don't use the same files with different domains/subdomains I didn't have to include the mainfile.php modification.

8
apleks
Re: TRUE Multisites hack.... at last!
  • 2004/2/23 14:01

  • apleks

  • Just popping in

  • Posts: 2

  • Since: 2004/2/4 2


Ok, I tried this and at first sight it works, I can share whatever table I want, that was a simple hack, though, very effective for me now!

Anyone has found the caveats yet ? Is there any except the fact that this is not configurable via the XOOPS Admin interface ?

9
basby
Re: TRUE Multisites hack.... at last!
  • 2004/2/23 17:57

  • basby

  • Not too shy to talk

  • Posts: 109

  • Since: 2003/1/28


What happens if there is a new XOOPS version. How to update your Xoops? In fact you need to chane more than one xoops-es,

Any ieas on that?

10
reynaldo
Re: TRUE Multisites hack.... at last!
  • 2004/2/23 19:31

  • reynaldo

  • Not too shy to talk

  • Posts: 106

  • Since: 2004/2/13


Quote:

basby wrote:
What happens if there is a new XOOPS version. How to update your Xoops? In fact you need to chane more than one xoops-es,

Any ieas on that?


Basby:
I'm using it with several domains, each one of them having their installation of Xoops. That's my setup, but as you can see from previous posts, you can modify the mainfile.php to run more than one XOOPS site from the same directory.

Anyway, if you have all your sites running from the same XOOPS installation, you would only have to upgrade one site and all of them would be automatically upgraded, *unless* a new version of XOOPS brings updates to the DB, in that case you would have to reinstall XOOPS to each one of the domains even if they all use the same dir.

That is the main reason why I wouldnt like to run lots of XOOPS sites from the same dir. I don't know, it would make me nervous knowing that if something goes wrong, all my sites would be down at once. And of course I would have to upgrade every site anyway after any major XOOPS release. Just my opinion and my 2 cents

Login

Who's Online

392 user(s) are online (269 user(s) are browsing Support Forums)


Members: 0


Guests: 392


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits