Closed (fixed)
Project:
KnowledgeTree integration
Version:
6.x-1.3
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
30 Sep 2008 at 10:20 UTC
Updated:
5 Oct 2008 at 11:42 UTC
How do I integrate KT with a multisite installation?
The lines from the kt_config.ini that are copied into KT's config.ini give a drupalURL .
This is effectively tying the installation to just one of the sites in a multi-site installation.
I have a working KT installation that is now integrated with one of my sites, but will not work with any others.
Rather than hard-coding this, how can I set this variable dynamically? What is it in Drupal that records which site it is serving? Could I set drupalURL = to that drupal variable?
Thanks in advance. As usual I will post anything I learn (assuming I do!)
Comments
Comment #1
alexpottHi Miles,
You sure are pushing the boundaries of the KT module! Good stuff...
In order to authenticate the user knowledge tree needs to access your drupal installation. It uses the urls provided in the config.ini in two places - the plugin and the logout.php. So you are going to need to work out how to get the correct url in both places.
One way of making this easier will be to use a single sign on accross all your site - see http://drupal.org/node/14697#comment-179572 and then you'll only have to fix/hack the logout.php
The change you will need to make is rather than use the url's configured in the config.ini the system should work them out from the current url using php's predefined variables like $_SERVER (http://uk.php.net/manual/en/reserved.variables.server.php).
So assuming you have two sites www.site1.com and www.site2.com and drupal is installed in the root you could change the class in logout.php to
The changes to DrupalPlugin.php are a bit more complicated - add a new function
And then replace and use of the config i.e $oKTConfig->get('drupalURL', false) with a call to the function e.g. line 22
IF drupal is not installed in the root then you're going to have a bit more fun working out the URL's
Hope this helps
Alex
Comment #2
mylesorme commentedThanks Alex, I'll give it a go..
Comment #3
mylesorme commentedI've had to hardcode the protocol to get it working since my knowledge of php is very limited...
With hard coding protocol to "http" it works - at least it loads in different sites - I've not yet fully tested the logout.
Fantastic!
Comment #4
mylesorme commentedOops...
I'm just testing on two sites for now - one loads, the other doesn't.
If I comment out the little script provided for the smarty template both load when the full path is entered:
http://www.site1.com/ktdms/
but when loading within Drupal one site loads, (but leaves the "loading bar" running) the other loads as far as the nav bar then stops.
At first I thought that the iframe was not expanding down, but I've since realised that the page is not loading beyond a certain point.
Any suggestions?
I do hope you are not running out of patience with me Alex!
Comment #5
mylesorme commentedThe problems start in line 55 of the standard page smarty:
{foreach item=sJavascript from=$page->getJSStandalone()}
var rootURL = "{$absoluteRootUrl}"; var quickQuery = "{$search2_quickQuery}"; {$sJavascript} and then carries on with any reference to rootURL. I know that rootURL is set in the config.ini file, and it is currently set to default. That value is originally: /ktdms What sets $absoluteRootUrl ? That seems to be the error, and whichever site calls it it is always the same one - so I must have set it somewhere manually...Comment #6
mylesorme commentedThe problem seems to be that KT caches the URL - so whichever site first calls the dms, that's the url that is cached.
I think this is the case - when I delete the files in kt/var/cache and reload kt the problem is solved... for that site.
Perhaps that means that if a person signs in to one site in one session they are ok. It looks as though it is cached for all sessions... too tired to work it out now!
Comment #7
alexpottThis is now completely KnowledgeTree :)
But hey - here's what I think... you've got two options.
1. Turn off the cache in KT's config.ini (probably not a good idea - it's slow enough as is!)
2. Have two cache directories depending on the servername variable... to do this... you're going to have to change the initConfig function in dmsDefaults.php to add in the servername every time it accesses the cache or sets the cache directory. This made more complicated by the fact that there seems to be to ways that the cache is set... but thats in KT 3.4... don't know if this has changed in 3.5
Comment #8
mylesorme commentedThanks Alex. I agree it is all KT now. I've been experimenting, but every 'solution' brings with it a new bag of issues.
At the end of the day KT isn't a multi-domain piece of software. It does allow for different units within one installation, but this is conceived to support different departments within one company, not loads of independent companies with different requirements.
I've changed tack - I'm now installing a separate KT codebase and database for each site that needs it!
The only difficulty this brings is getting the paths right!
Comment #9
mylesorme commented