[2.0] Smartifying the backend

Mark threads with "[2.0]" for discussions about features in the longer-term future, "[1.6]" is for short-term. This is not the place for general discussions or plugin or template requests. Only features that are approved to happen by the core team should be listed here for better structuring.
User avatar
blog.brockha.us
Regular
Posts: 695
Joined: Tue Jul 03, 2007 3:34 am
Location: Berlin, Germany
Contact:

Re: [2.0] Smartifying the backend

Post by blog.brockha.us » Thu Apr 05, 2012 1:29 pm

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"?
- Grischa Brockhaus - http://blog.brockha.us
- Want to make me happy? http://wishes.brockha.us/

User avatar
yellowled
Regular
Posts: 7017
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: [2.0] Smartifying the backend

Post by yellowled » Thu Apr 05, 2012 1:34 pm

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
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
blog.brockha.us
Regular
Posts: 695
Joined: Tue Jul 03, 2007 3:34 am
Location: Berlin, Germany
Contact:

Re: [2.0] Smartifying the backend

Post by blog.brockha.us » Thu Apr 05, 2012 1:55 pm

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.
- Grischa Brockhaus - http://blog.brockha.us
- Want to make me happy? http://wishes.brockha.us/

User avatar
garvinhicking
Core Developer
Posts: 30014
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: [2.0] Smartifying the backend

Post by garvinhicking » Thu Apr 05, 2012 2:40 pm

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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

User avatar
blog.brockha.us
Regular
Posts: 695
Joined: Tue Jul 03, 2007 3:34 am
Location: Berlin, Germany
Contact:

Re: [2.0] Smartifying the backend

Post by blog.brockha.us » Thu Apr 05, 2012 2:48 pm

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?
- Grischa Brockhaus - http://blog.brockha.us
- Want to make me happy? http://wishes.brockha.us/

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: [2.0] Smartifying the backend

Post by Timbalu » Thu Apr 05, 2012 3:04 pm

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!)
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

User avatar
garvinhicking
Core Developer
Posts: 30014
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: [2.0] Smartifying the backend

Post by garvinhicking » Thu Apr 05, 2012 3:20 pm

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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

User avatar
blog.brockha.us
Regular
Posts: 695
Joined: Tue Jul 03, 2007 3:34 am
Location: Berlin, Germany
Contact:

Re: [2.0] Smartifying the backend

Post by blog.brockha.us » Thu Apr 05, 2012 3:22 pm

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.)
- Grischa Brockhaus - http://blog.brockha.us
- Want to make me happy? http://wishes.brockha.us/

User avatar
garvinhicking
Core Developer
Posts: 30014
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: [2.0] Smartifying the backend

Post by garvinhicking » Thu Apr 05, 2012 3:36 pm

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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: [2.0] Smartifying the backend

Post by Timbalu » Thu Apr 05, 2012 7:13 pm

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
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

User avatar
onli
Regular
Posts: 2230
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: [2.0] Smartifying the backend

Post by onli » Thu Apr 05, 2012 8:42 pm

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':

User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: [2.0] Smartifying the backend

Post by Timbalu » Fri Apr 06, 2012 9:53 am

:D OH YES. That one is doing right. Well done, Malte!
Shall we put this into master and 2.0, Garvin?
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian

User avatar
garvinhicking
Core Developer
Posts: 30014
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: [2.0] Smartifying the backend

Post by garvinhicking » Sat Apr 07, 2012 9:44 am

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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

User avatar
yellowled
Regular
Posts: 7017
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: [2.0] Smartifying the backend

Post by yellowled » Mon Apr 09, 2012 5:06 pm

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
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
onli
Regular
Posts: 2230
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: [2.0] Smartifying the backend

Post by onli » Tue Apr 10, 2012 12:41 am

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.

Locked