The following warnings occurred: | ||||||||||||
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
|
Connecting Multiple Installations - Printable Version +- UserSpice (https://userspice.com/forums) +-- Forum: Miscellaneous (https://userspice.com/forums/forumdisplay.php?fid=28) +--- Forum: Modifications and Hackery (https://userspice.com/forums/forumdisplay.php?fid=29) +--- Thread: Connecting Multiple Installations (/showthread.php?tid=525) |
Connecting Multiple Installations - Brandin - 04-15-2017 Hello, Another big project of mine I am going to work on! ***YOU CAN SKIP TO MY NEXT STARS IF YOU DON'T WANT TO FULLY UNDERSTAND WHAT'S GOING ON AND TRY TO ANSWER THE QUESTION*** I have a few systems I have designed, all on different subdomains: -templates.*.com -search.*.com -boss.*.com BOSS is my UserSpice installation I have fully customized to be a tracking solution for our Call Centre. I have finally converted the majority of my scripts to PDO using the UserSpice system, but I am still working on it. I am starting to redesign the templates.*.com site which is a page of email templates, with information pulled from the Code: categories Code: templates Since I am redesigning it (from ground up) I might as well do the PDO conversion now, rather than recode it, and do it later, and I find PDO to be very easy to us. However, I love the functions built into the UserSpice software, and would like to use that in the templates site too. ***SKIP TO HERE*** I am running into a problem including init and header on a different subdomain, since it is using the abs_root and other applicable things that is relying on the subdomain to be the same as BOSS, but it is not. So, I reverted to doing an extra installation of UserSpice, connected to the same database, but it didn't like this and screwed up the pages system, most likely because there was two page functions running in different domains. I have since decided to scrap that idea, and have two separate installations of UserSpice, with two different databases, but then I run into this issue: In BOSS, I have a system called "External Management", this is what I use to control the templates and categories, and I don't want to recode it. I have a Requests Management System, the whole nine yards, if templates and categories tables are going to be in a different database, how am I going to get UserSpice to talk to that one? And I will then have to make custom functions to talk to it, won't I? Is there any easier solution to my problem that I just can't think of? Thank you in advance! Connecting Multiple Installations - JUG - 04-16-2017 I don't know how US would behave but maybe two separate installations but only one database? Connecting Multiple Installations - Brandin - 04-16-2017 I had thought about this, and tried it, but the admin pages caused issued, specifically admin_page.php. When it runs the query to find the pages defined in the files in that installation, it clears the pages DB and only has the pages from that installation. Maybe if I remove that page it would resolve the issue? Thank you. Connecting Multiple Installations - Brandin - 04-28-2017 @mudmin, Do you have any thoughts on having UserSpice talk to two different databases? I am considering two different US installations with two separate databases. One installation will use one database (the templates site) - the other will be the primary site which is going to use the main DB, plus the secondary DB, to manage the tables, including viewing, editing, adding and removing templates and categories. Thoughts? Connecting Multiple Installations - mudmin - 04-29-2017 I just wrote you something to connect to two databases without editing any core files. ***Step 1*** Save this file as DB2.php and put it in users/classes https://pastebin.com/8r1qSzZ1 ***Step 2*** Then, backup your existing init.php file and edit it....Take the section around line 25 and change it from... (obviously using your own db credentials for the first and second db) $GLOBALS['config'] = array( 'mysql' => array('host'=> 'localhost', 'username' => 'root', 'password' => '', 'db' => '422', ), 'remember' => array( TO $GLOBALS['config'] = array( 'mysql' => array('host'=> 'localhost', 'username' => 'root', 'password' => '', 'db' => '422', ), 'mysql2' => array('host2'=> 'localhost', 'username2' => 'root', 'password2' => '', 'db2' => '423', ), 'remember' => array( ***Step 3*** Later in init.php, right after the include of DB.php add require_once $abs_us_root.$us_url_root.'users/classes/DB2.php'; ***Step 4*** In usersc/includes/navigation.php change lines 1 and 2 from Code: <?php Code: ?> to Code: <?php $db2 = DB2::getInstance(); ?> Then you just make your queries like this... Code: $query = $db2->query("SELECT * FROM users"); Code: $count = $query->count(); Connecting Multiple Installations - Brandin - 04-29-2017 Thank you so much Mudmin! I imagine this will work fine, but I will let you know for sure! Connecting Multiple Installations - mudmin - 04-29-2017 yeah. Absolutely. Keep me posted. Connecting Multiple Installations - Brandin - 04-29-2017 What do you think about setting up mySQL Replication? I would use this for my users and permissions table to ensure the user data between the two tables is synced regularly. Or do you think running updates to both DBs would be better? Trying to make sure I have these two databases talking as much as I can to decrease the amount of user backlog I guess you would say. Connecting Multiple Installations - Brandin - 05-12-2017 @Mudmin, I haven't plugged this in yet, but thank you for this. Now I'm focusing on authentication and users. Is O-Auth between two installations possible? On templates.* I want to have an O-Auth feature to sign in using "BOSS" which is my other installation. Is this possible? Connecting Multiple Installations - mudmin - 05-14-2017 I think you can add multiple urls for your google/facebook accounts. It would be done on their side when you're doing the initial setup of your fb/google services. |