Page 9 of 12

Re: [2.0] Smartifying the backend

Posted: Thu Apr 05, 2012 1:29 pm
by blog.brockha.us
garvinhicking wrote:This code is required for shared installations, we cannot simply change/remove it.
Can you explain a little, why this is the case? Perhaps with a little example, where the problem is?

Can we have a switch in the advanced configuration perhaps: "Server has a DOCUMENT_ROOT pointing to one directory only"?

Re: [2.0] Smartifying the backend

Posted: Thu Apr 05, 2012 1:34 pm
by yellowled
garvinhicking wrote:This code is required for shared installations, we cannot simply change/remove it.

Installing s9y on a subdomain that has the document_root not set to the root of the subdomain, with a s9y on the main domain will never work. I don't see an easy way to patch this, without opening a huge can of worms for other currently working scenarios.
Hmpf. I should've assumed there's a good reason for doing it the way we do it.

Not that it would be a solution in my case, but would a shared installation in which the "parent" is on the domain and the "children" are on subdomains work here?
garvinhicking wrote:Can't you check with your provider if DOCUMENT_ROOT can be changed to the real path of the subdomains core directory properly?
I don't think so, the way they handle subdomains etc. is part of their hosting concept. It's not even that important since I only wanted to setup a temporary dev blog on a subdomain.

YL

Re: [2.0] Smartifying the backend

Posted: Thu Apr 05, 2012 1:55 pm
by blog.brockha.us
Can't we do something like that in a file located in / ?

Code: Select all

$document_root = $_SERVER['DOCUMENT_ROOT']
// If we don't have a shared installation, check if it is a "modRewrite subdomain" and fix this:
if (!defined('S9Y_DATA_PATH')) {
  $document_root = dirname(__FILE__);
}

define('S9Y_DOCUMENT_ROOT', $document_root);
With that we can use S9Y_DOCUMENT_ROOT instead of $_SERVER['DOCUMENT_ROOT'], what would do the same on older installations: It will work like always on shared installations but would check the real path of rewrite subdomains like we have at uberspace.

On servers like uberspace we can do shared installations using the installation in the main html directory only, but I think: If someone use shared installations, that's the normal case. At least it would fit more server environments than before but don't change the old cases as far as I survey it.

Re: [2.0] Smartifying the backend

Posted: Thu Apr 05, 2012 2:40 pm
by garvinhicking
Hi!

I'd really not like to mess around with that code, and don't really have the motivation to reinvestigate all these issues. They were hard enough to get done in first place. ;)

I only know that it took several tries and many efforts to get to the place we currently have, which makes it work with embedded, shared, and single installs, and on both IIS, Apache and other CGI-Servers like nginx, which all not always properly return pathname structures...


Regards,
Garvin

Re: [2.0] Smartifying the backend

Posted: Thu Apr 05, 2012 2:48 pm
by blog.brockha.us
So the decision left for me is: Leave uberspace or Serendipity, right? :?
(I don't want to patch again and again, but I need to have my blog working in a subdomain.)

But from a logical point of view my patch should work, shouldn't it?

Re: [2.0] Smartifying the backend

Posted: Thu Apr 05, 2012 3:04 pm
by Timbalu
We do have a special 1&1 server workaround, don't we? Maybe we can serve something for this matter too?
But may I just note here...
Since this is a installation question preparing S9y in general, this becomes quite OT in this thread, as there are still some remaining questions left... (OK well, the table engine one is it too, I have to admit, but the possible bug regarding ...BaseURL is still in the pipe hoping to get solved somehow!)

Re: [2.0] Smartifying the backend

Posted: Thu Apr 05, 2012 3:20 pm
by garvinhicking
Hi!

Isn't there a way to make when calling http://yoursubdomain.domain.com/index.php to have "index.php" get $_SERVER['DOCUMENT_ROOT'] as /var/www/domains/domain.com/subdomain/httpdocs for example, instead of getting the document_root from the main domain?

PLESK for example offers a config switch to make subdomains get their own docroot.

You could add a .htaccess with php_auto_prepend file, in which you change $_SERVER['DOCUMENT_ROOT'] on your own...how about that?

Regards,
Garvin

Re: [2.0] Smartifying the backend

Posted: Thu Apr 05, 2012 3:22 pm
by blog.brockha.us
Yes, please move the related posts to a new thread please. :)

Btw: I found, if you do the advanced installation, you can define the root directory of the blog. It is filled with the correct value (for the uberspace case). If I use the advanced config, the blog is running.

It doesn't have any plugins installed, so it is very naked, but it seems, the uberspace case is already somewhat supported.. I have to investigate more..

Why might it be, that the default plugin installation is missing? (No admin link i.e.)

Re: [2.0] Smartifying the backend

Posted: Thu Apr 05, 2012 3:36 pm
by garvinhicking
Hi!

I wouldn't know. "register_Default_plugins" of the plugin_api.inc.php is called within include/admin/installer.inc.php. IF you are using the 2.0 branch, maybe this option did not get ported properly; in 1.7 this is here:

https://github.com/s9y/Serendipity/blob ... er.inc.php

(line 548)

(UPDATE). Wait. If serendipity_authors (DB table) already exists, this step is ignored. So that might be the reason, if your previous installs failed. Try with a fresh DB and install again.

Regards,
Garvin

Re: [2.0] Smartifying the backend

Posted: Thu Apr 05, 2012 7:13 pm
by Timbalu
It has been ported properly! It must be the authors table.

@Garvin
Remember we still have this problem with defaultBaseURL not being set properly in installation step 2b and always show the default value http://www.example.com/serendipity/ .

I wounded my eyes since yesterday to find an issue I might have produced by porting this to smarty, but could not find any...

Might this commit by you and Manko10 be the very problem?
https://github.com/s9y/Serendipity/comm ... c104b8d4c3

Re: [2.0] Smartifying the backend

Posted: Thu Apr 05, 2012 8:42 pm
by onli
I wounded my eyes since yesterday to find an issue I might have produced by porting this to smarty, but could not find any...
It's really twisted. I'll try to find it now and write it down here as i go.

http://www.example.com/serendipity/ is the default of defaultBaseURL, defined in config-local.inc.php. This gets called in the installer.inc.php by

Code: Select all

$config = serendipity_parseTemplate(S9Y_CONFIG_TEMPLATE);
because of

Code: Select all

/var/www/serendipity_config.inc.php:define('S9Y_CONFIG_TEMPLATE',     S9Y_INCLUDE_PATH . 'include/tpl/config_local.inc.php');
serendipity_printConfigTemplate (in functions_installer.inc.php) is called afterwards, which itself calls serendipity_query_default. There is the relevant code which seems to be the old auto-detection:

Code: Select all

case 'baseURL':
            $ssl  = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on';
            $port = $_SERVER['SERVER_PORT'];

            return sprintf('http%s://%s%s%s',

                            $ssl ? 's' : '',
                            preg_replace('@^([^:]+):?.*$@', '\1', $_SERVER['HTTP_HOST']),
                            (($ssl && $port != 443) || (!$ssl && $port != 80)) ? (':' . $port) : '',
                            rtrim(dirname($_SERVER['PHP_SELF']), '/') .'/'
                   );
But nothing for serendipity['defaultBaseURL'].

So you're right, that's probably the issue here, a bug in master. It's probably fix enough to add

Code: Select all

case 'defaultBaseURL':
above

Code: Select all

case 'baseURL':

Re: [2.0] Smartifying the backend

Posted: Fri Apr 06, 2012 9:53 am
by Timbalu
:D OH YES. That one is doing right. Well done, Malte!
Shall we put this into master and 2.0, Garvin?

Re: [2.0] Smartifying the backend

Posted: Sat Apr 07, 2012 9:44 am
by garvinhicking
Timbalu wrote::D OH YES. That one is doing right. Well done, Malte!
Shall we put this into master and 2.0, Garvin?
Yes, please! Sounds reasonable to me! Thanks!

Regards
Garvin

Re: [2.0] Smartifying the backend

Posted: Mon Apr 09, 2012 5:06 pm
by yellowled
So what's the status on this now? Should it now work properly with a "false" DOCUMENT_ROOT or were the last posts about something entirely different? (No, I don't want to "test install" it since it messes with my running productive blog in the root domain.)

YL

Re: [2.0] Smartifying the backend

Posted: Tue Apr 10, 2012 12:41 am
by onli
the last posts were about the missing autodetection of baseURL in the installer. The DOCUMENT_ROOT-issue seems to be unresolved, though Garvin and Grischa had ideas - could someone with admin rights move the posts regarding that issue in an own thread in the bugforum? It's wrong here (it was right here at first) and we are losing sight of it if everything is mangled in one thread.