Page 1 of 1
"Latest Entries with PHP" and shared installation
Posted: Sun Dec 24, 2006 1:33 am
by stm999999999
Hello,
I am in deep trouble.
I use some of my articles on an external page as described on
http://www.s9y.org/206.html
first, all was OK. but:
I changed my installation: The blog is now a shared installation (with symlinks).
so I have:
Code: Select all
+cms-s9y+s9y (the core-installation)
+my-blog
+other-blog
+external-page
and 1) my external-entries-tpl in my used template is not found and (after copying it to the standard template directory) no article of my choosen category is found!
So, I think, the problem is here:
Code: Select all
<?php
// 1: Switch to the Serendipity path
chdir('../my-blog/');
// 2: Start the Serendipity API
include 'serendipity_config.inc.php';
// 3: Start Smarty templating
serendipity_smarty_init();
the external pages goes to the right blog-dir, but there the serendipity_config.inc.php is a shared-installation-dummy and includes the serendipity_config.inc.php of ../s9y and then the wrong serendipity_config_local.inc.ph is used: not the one of ../my-blog but the ../s9y! So it wants to use the template of s9y and not my-blog and it wants to read the wrong database

Posted: Sun Dec 24, 2006 1:25 pm
by stm999999999
OK, I think I found it:
Code: Select all
if (file_exists($_SERVER['DOCUMENT_ROOT'] . dirname($_SERVER['PHP_SELF']) . '/serendipity_config_local.inc.php')) {
$local_config = $_SERVER['DOCUMENT_ROOT'] . dirname($_SERVER['PHP_SELF']) . '/serendipity_config_local.inc.php';
} elseif (file_exists($serendipity['serendipityPath'] . '/serendipity_config_local.inc.php')) {
$local_config = $serendipity['serendipityPath'] . '/serendipity_config_local.inc.php';
} elseif (defined('S9Y_DATA_PATH')) {
// Shared installation!
$local_config = S9Y_DATA_PATH . '/serendipity_config_local.inc.php';
} else {
// Installation fallback
$local_config = S9Y_INCLUDE_PATH . '/serendipity_config_local.inc.php';
}
The second if (the first elseif) is true, because in /cms-s9y/s9y I have a serendipity_config_local.inc.php. Because I wanted to administrate the whole blog-system with this (e.g. update plugins via Spartacus etc.).
Now, I delete the serendipity_config_local.inc.php there and all works fine, the third if matches now:
Code: Select all
elseif (defined('S9Y_DATA_PATH')) {
// Shared installation!
Is there any trouble, when we resort this if-clauses?
When we take the shared installation before the "$serendipity['serendipityPath']"-if?
Posted: Thu Dec 28, 2006 8:55 pm
by garvinhicking
Hi!
Ah, okay. No problems are expected then. The local config just confuses the shared installs, because shared sources are not meant to be "active".
HTH,
Garvin
Posted: Sat Dec 30, 2006 5:23 pm
by stm999999999
Do you insert it into the CVS?
Posted: Sat Dec 30, 2006 9:25 pm
by garvinhicking
Hi!
What exactly? I thought no modifications were needed.
Regards,
Garvin
Posted: Sat Dec 30, 2006 9:34 pm
by stm999999999
in the moment it works with the actual code, because I delete the config-file in the core-installation.
But it would be nice to have the core-installation "active", too.
so it would be fine to resort the if clauses:
not
Code: Select all
elseif (file_exists($serendipity['serendipityPath'] . '/serendipity_config_local.inc.php')) {
$local_config = $serendipity['serendipityPath'] . '/serendipity_config_local.inc.php';
} elseif (defined('S9Y_DATA_PATH')) {
// Shared installation!
$local_config = S9Y_DATA_PATH . '/serendipity_config_local.inc.php';
}
but
Code: Select all
elseif (defined('S9Y_DATA_PATH')) {
// Shared installation!
$local_config = S9Y_DATA_PATH . '/serendipity_config_local.inc.php';
}
elseif (file_exists($serendipity['serendipityPath'] . '/serendipity_config_local.inc.php')) {
$local_config = $serendipity['serendipityPath'] . '/serendipity_config_local.inc.php';
}
as I understand you right, this resort would have no negative effect, right?
Posted: Sat Dec 30, 2006 9:39 pm
by garvinhicking
Hi!
But it would be nice to have the core-installation "active", too.
Ah. Hm, that's currently not on my personal todo-list. The problem is that with your shuffled if-clauses this might break proper installations with symlinked directories and open_basedir restrictions. In case those installations are on a server where a shared installation resorts, this would activate a shared installation without the user wanting this.
So this would require some very intense testing that I currently have no time for. Since it introduces a new feature that was not kept in mind when developing shared installs, I prefer to not break existing things. Hope you can understand that?
Regards,
Garvin
Posted: Sat Dec 30, 2006 10:09 pm
by stm999999999
garvinhicking wrote:Hi!
But it would be nice to have the core-installation "active", too.
Ah. Hm, that's currently not on my personal todo-list. The problem is that with your shuffled if-clauses this might break proper installations with symlinked directories and open_basedir restrictions.
hm, my installation is one with symlinks and I have open_basedir-restrictions!?
In case those installations are on a server where a shared installation resorts, this would activate a shared installation without the user wanting this.
why should my resort activate a shared installation? This will be activated only when the user generates a personal_config.inc.php in the core-directory!?
The new order of the if-clauses has in my eyes only one effect:
first s9y looks, if it is started by a shared side (and not by the core-installation). If it is not, then it looks if there is a config-file in serendipityPath.
With the actual code it will first look in serendipityPath (where, as you say, normaly is no config-file) and if the user explicit wants to have an active s9y there, then it uses this config-file, even it s9y is started by a shared site, what is bad.
If the user do not want the core-installation active, then there is no config-file there and it should be absolut unimportant, what the order of the if-clauses is. Or?
Posted: Tue Jan 02, 2007 11:15 am
by garvinhicking
Hi!
Thanks for the detailed explanation. Seems I misread the patch initially. I now committed your changes.
Best regards,
Garvin