The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.18 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Connecting Multiple Installations
#1
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
table to design the tabs, and the
Code:
templates
table to have the 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!
  Reply
#2
I don't know how US would behave but maybe two separate installations but only one database?

  Reply
#3
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.
  Reply
#4
@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?
  Reply
#5
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();
  Reply
#6
Thank you so much Mudmin! Smile

I imagine this will work fine, but I will let you know for sure!
  Reply
#7
yeah. Absolutely. Keep me posted.
  Reply
#8
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.
  Reply
#9
@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?
  Reply
#10
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.
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)