Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.7 > vBulletin 3.7 Add-ons

Reply
 
Thread Tools
Share users database among many forums Details »»
Share users database among many forums
Version: 0.10, by mangel.ajo mangel.ajo is offline
Developer Last Online: May 2012 Show Printable Version Email this Page

Category: Major Additions - Version: 3.7.2 Rating:
Released: 07-10-2008 Last Update: 07-12-2008 Installs: 61
Re-useable Code Code Changes Translations Is in Beta Stage  
No support by the author.

This is a feature requested many times, and we are still waiting, so I released a patch to be able to run many forums with the same user database.

This is an EXPERIMENTAL PATCH I'm running on my forums.

Code:
--- ../../../private/upload/includes/class_core.php     2008-07-10 11:17:32.000000000 +0200
+++ class_core.php      2008-07-11 17:44:20.000000000 +0200
@@ -405,6 +405,33 @@
                $this->connection_recent =& $link;
                $this->querycount++;

+               $shared_tables = Array("user","useractivation","userban","usertitle","userchangelog","usertextfield","userfield","usergroup","userlist","usernote","profilevisitor","reputation","reputationlevel","spamlog","strikes","pm","pmreceipt","pmtext","avatar","profilefield");
+
+               $main_prefix = "FP_";
+               foreach ($shared_tables as $shared_table)
+               {
+                       $orig = TABLE_PREFIX.$shared_table;
+                       $dst  = $main_prefix.$shared_table;
+
+                       $this->sql = str_replace($orig." ",$dst." "  ,$this->sql);
+                       $this->sql = str_replace($orig.".",$dst."."  ,$this->sql);
+                       $this->sql = str_replace($orig."\r",$dst."\r",$this->sql);
+                       $this->sql = str_replace($orig."\n",$dst."\n",$this->sql);
+                       $this->sql = str_replace($orig."\t",$dst."\t",$this->sql);
+
+               }
+

                if ($queryresult = $this->functions[$buffered ? 'query' : 'query_unbuffered']($this->sql, $link))
                {
You can add "session" to $shared_tables if you want to share your sessions among forums under the same domain (Thanks Lionel)

This is only useful for new forums joining anothers one user database.

Requirements:
  • An old forum where all users are.
  • Sharing the same database, using diferent prefixes for tables (TABLE_PREFIX)
For example: Imagine we have FORUM_A , FORUM_B, and FORUM_C each one with their respective licenses.

FORUM A has table prefix FA_ in database, FORUM_B has FB_ and FORUM_C has FC_

FORUM A is the main, and older forum, where we have all our users.

then we would install FORUM_B and FORUM_C normally, using the same database that FORUM_A uses, but setting up their own table prefixes.


once FB_ and FC_ are installed then we go patching class_core.php from FORUM_B and FORUM_C setting up $main_prefix = "FA_"; so they use FORUM_A for shared tables.

Possible problems:
  • memcached issues?, not sure
  • avatar/signature pics/etc issues when storage is set to disk.
  • more to come...


Author: Optimizacion Web

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #22  
Old 07-13-2008, 06:14 AM
tfw2005 tfw2005 is offline
 
Join Date: Sep 2004
Posts: 58
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So, if you have 4 forums active, with members and posts now, you would first need to merge the databases manually, making sure each have their own prefix in the new mega DB. Then, somehow import just users from the other 3 into the primary one, and merge accounts for duplicate users. Then install the script, and use primary site user tables from there forward. That sound right?

Second, how is performance affected? I have several 1 million+ post forums, probably 100,000 members between them. After combining it all, the DB would be 4-6 gigs. Those are some large table scans. When server load is heavy now, I get issues with a 1.5 gig DB being accessed repeatedly (getting new server, but still).

So, yes, I know you need a solid server just to handle a large DB situation in general, but, how much overhead does this script use, and could it "crap out" if dealing with large amounts of data like this. Several 1000+ users online sites accessing the same DB concurrently.

Disk based avatars and profile pics need to be addressed, as anyone with a lot of members most likely moved to that. Xcache, memcached, eaccelerator issues need to be tested for sure. I couldn't use that until it was in some way.

Question - I take it this does not "log you in" to another site, on another domain, it just makes your user account available to log in again if you go there, correct? So you are logged in and viewing site A, then jump to site B, you would need to log into site B then again. Site A and B are different domains. Correct?

RE: Mysql view, I looked into that, and many people online say that it is not designed for high volume usage, and could actually slow things down. Tho, I just quickly scanned, and don't have deep knowledge of it in general. I'd like to hear how the view technique would work in the above situation too.

And, for the record, I would love VB to have something built into the backend for this officially, more integrated and optimized. Would allow for some really cool stuff.
Reply With Quote
  #23  
Old 07-13-2008, 08:44 AM
mangel.ajo mangel.ajo is offline
 
Join Date: Oct 2006
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by tfw2005 View Post
So, if you have 4 forums active, with members and posts now, you would first need to merge the databases manually, making sure each have their own prefix in the new mega DB. Then, somehow import just users from the other 3 into the primary one, and merge accounts for duplicate users. Then install the script, and use primary site user tables from there forward. That sound right?
Hmmm, that's the most complex situation, joining forums that are already running.

First of all, you would have to merge all the users in the Primary forum database, and then -somehow- manage to change all your userid's from pms, posts, threads, and so one to the new ID of the joined database. I'm not sure but that could require specific scripts.
[/quote]

Quote:
Second, how is performance affected? I have several 1 million+ post forums, probably 100,000 members between them. After combining it all, the DB would be 4-6 gigs. Those are some large table scans. When server load is heavy now, I get issues with a 1.5 gig DB being accessed repeatedly (getting new server, but still).
It should add len(shared_tables)*4 str_replaces to every SQL query your system is doing. Probably is not too much, but it's load, of course. (We could do some tests to discover how much is that.)

We should also think if mysql would also penalyze us by having all the tables in one database with same prefix.

Quote:
So, yes, I know you need a solid server just to handle a large DB situation in general, but, how much overhead does this script use, and could it "crap out" if dealing with large amounts of data like this. Several 1000+ users online sites accessing the same DB concurrently.
We will have to analyze that. May be running some test over real vbulletin querys and measuring time.

Quote:
Disk based avatars and profile pics need to be addressed, as anyone with a lot of members most likely moved to that. Xcache, memcached, eaccelerator issues need to be tested for sure. I couldn't use that until it was in some way.
I've been thinking more deeply about memcached / xcache an so on, and probaby it won't be a problem, but we must test.

Quote:
Question - I take it this does not "log you in" to another site, on another domain, it just makes your user account available to log in again if you go there, correct? So you are logged in and viewing site A, then jump to site B, you would need to log into site B then again. Site A and B are different domains. Correct?
Yes, exactly, that's it. Don't know if it would be possible to develop some kind of mechanism to move around forums using the different session tables to move around forums.

Quote:
RE: Mysql view, I looked into that, and many people online say that it is not designed for high volume usage, and could actually slow things down. Tho, I just quickly scanned, and don't have deep knowledge of it in general. I'd like to hear how the view technique would work in the above situation too.
I've never tested it, and for the simplest idea (having the mirror of a diferent table it should'nt be so slow. But analyzing VIEW in depth you can see it let's you make some complex views selecting some rows in tables, and that its a complex situation, and being prepared for that could be the reason of slowliness.

Quote:
And, for the record, I would love VB to have something built into the backend for this officially, more integrated and optimized. Would allow for some really cool stuff.
Absolutely: me too.
Reply With Quote
  #24  
Old 07-13-2008, 02:44 PM
Datenpapst Datenpapst is offline
 
Join Date: Mar 2004
Location: Vienna
Posts: 301
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi,
is it possible that maybe some forums like off topic or so can also be used by more than 1 forum?
Reply With Quote
  #25  
Old 07-13-2008, 04:53 PM
Super Jinni Super Jinni is offline
 
Join Date: Mar 2008
Posts: 437
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

does that work if the new forum in another server and have completely another domain?
Reply With Quote
  #26  
Old 07-16-2008, 03:19 PM
Tekmon Tekmon is offline
 
Join Date: Jan 2008
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I just want to make sure... This is for Seperate URL's/Licenses to share the same User tables. Correct?

When I download the file I get a diff file and I do not know what to do with it.

Thanks
Reply With Quote
  #27  
Old 07-17-2008, 04:46 AM
Tekmon Tekmon is offline
 
Join Date: Jan 2008
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Could you please tell me where in class_core.php I put the code?
There seems to be many sections that this could go in.

I am guessing I put in the code with the "+"'s on the front of the line and
to remove those "+"'s as well?

Thanks
Reply With Quote
  #28  
Old 07-18-2008, 04:54 PM
takerman takerman is offline
 
Join Date: Dec 2007
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hello,

or should he put the php codes I put in class_core but I have this error

Parse error: syntax error, unexpected $end in /home/www/fd0ea7be7c752c55ff235159345d0e2a/web/tnawrestling/includes/class_core.php on line 3326

sorry for me english
Reply With Quote
  #29  
Old 07-24-2008, 11:01 AM
TraumTeam TraumTeam is offline
 
Join Date: Apr 2002
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is this the project to run several different Forums (search, new Thread, Categories...) but with the same userdatabase and login?

I requestet this about 5 years ago in vbulletin support forum and i got the answer, that this wont work.

It is very interesting for sites with very different content categories. This is a very nice try and i hope you get it done.

best regards
rob
Reply With Quote
  #30  
Old 07-26-2008, 11:36 AM
lovevn lovevn is offline
 
Join Date: May 2004
Posts: 116
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What should I do if my main forum used no prefix?Shoud I use this:
$main_prefix = " ";
Reply With Quote
  #31  
Old 07-27-2008, 07:03 AM
dazed12 dazed12 is offline
 
Join Date: Jul 2006
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i installed my main forums without a prefix. im having probs getting it to work. also do you leave the + on the code?
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:44 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04903 seconds
  • Memory Usage 2,312KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_code
  • (7)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete