1.6->1.7: blogurl missing

Found a bug? Tell us!!
User avatar
onli
Regular
Posts: 2227
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

1.6->1.7: blogurl missing

Post by onli » Sun May 12, 2013 2:42 pm

I experienced it now myself: After the upgrade, the blogurl-option in Configuration -> Paths was empty. I'll try to find out why, but maybe someone else already found it?

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

Re: 1.6->1.7: blogurl missing

Post by Timbalu » Sun May 12, 2013 3:00 pm

I did upgrade an RC manually and another one with autoupdate without any problems.
Knowing about this issue, I have looked into Configs baseURL before and after, and all was fine.

Which version did you upgrade? (ups, should have read the title)
Did you check your settings before?

It would be really fine to close this "imminent sword of Damocles".
Regards,
Ian

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

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

Re: 1.6->1.7: blogurl missing

Post by Timbalu » Sun May 12, 2013 3:04 pm

Was it a "http://" or relative path you had?
Regards,
Ian

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

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

Re: 1.6->1.7: blogurl missing

Post by onli » Sun May 12, 2013 3:11 pm

So, first thoughts:

1. The option in the template is called {$serendipityBaseURL}.
2. The option in the config_local.inc.php is called defaultBaseURL.
3. That option was renamed in this commit https://github.com/s9y/Serendipity/comm ... al.inc.php 2 years ago.
4. What happens on install? My guess right now is that i first should look at what happens on a normal config read, which is the line

Code: Select all

$from = &$serendipity;
$t = serendipity_parseTemplate(S9Y_CONFIG_TEMPLATE);
serendipity_printConfigTemplate($t, $from, false, true);
in https://github.com/s9y/Serendipity/blob ... on.inc.php.
5. But in https://github.com/s9y/Serendipity/blob ... ig.inc.php in function serendipity_load_configuration:

Code: Select all

// Set baseURL to defaultBaseURL
if ((empty($author) || empty($serendipity['baseURL'])) && isset($serendipity['defaultBaseURL'])) {
    $serendipity['baseURL'] = $serendipity['defaultBaseURL'];
}
So we have fallback-code to fill that variable if baseURL is empty but defaultBaseURL is set. Which doesn't apply when defaultBaseURL is empty but baseURL set.
6. https://github.com/s9y/Serendipity/blob ... er.inc.php, parseConfig. $from is here $serendipity. If I see that correctly, there is a mismatch between baseURL and defaultBaseURL.

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

Re: 1.6->1.7: blogurl missing

Post by onli » Sun May 12, 2013 3:14 pm

Ian:
Did you check your settings before?
No. But it sure wasn't empty.
Was it a "http://" or relative path you had?
Shouldn't change anything, but as I didnt check, I don't know.

Probably on old installations, only blogURL is set in the database and that breaks now. Hard to debug -.-

Edit: But i have a backup of the database. I will see how the option-table looks like and whether that fortifies my suspicion.

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

Re: 1.6->1.7: blogurl missing

Post by onli » Sun May 12, 2013 3:23 pm

Jep. In the db-backup of my 1.6-installation, the only config-key is baseURL. defaultBaseURL doesn't exist. In the current db, there is both:

Code: Select all

mysql> select name, value from serendipity_config WHERE name = 'baseURL' OR name = 'defaultBaseURL';
+----------------+------------------------------+
| name           | value                        |
+----------------+------------------------------+
| baseURL        | http://www.onli-blogging.de/ |
| defaultBaseURL | http://www.onli-blogging.de/ |
+----------------+------------------------------+
Anyone has a blog older than 2 years which is not already upgraded to 1.7? What is the output of

Code: Select all

select name, value from serendipity_config WHERE name = 'baseURL' OR name = 'defaultBaseURL';
in the db? Can you coordinate with me when upgrading s o you can try out my fix which i then probably have?

Seems to me, the fix would be to load baseURL if it exists when defaultBaseURL is asked when initializing $serendipity. Didn't I already commit something like that before? Ian, you mentioned that yesterday or the day before, do you remember where that was?

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

Re: 1.6->1.7: blogurl missing

Post by Timbalu » Sun May 12, 2013 3:57 pm

I have a dev 1.6.1 here (can't say this is old enough, since it has lots of developer drop-ins over the years)

Your DB query says:
baseURL = http://example.com/blogs/serendipity/

Does that help?

(btw, I talked about baseURL and I have updated my first answer post, your thread title misled me...)

Edit
https://github.com/s9y/Serendipity/comm ... 37b9b1d6e6
Regards,
Ian

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

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

Re: 1.6->1.7: blogurl missing

Post by onli » Sun May 12, 2013 4:02 pm

Perfect! Pls don't do anything with that blog.

If my theory is right, upgrading that blog would cause the bug (as baseURL is no longer correctly read in 1.7 cause the option now is called defaultBaseURL). So, The fix to the bug would be to either
1. read baseURL if it exists in the db
2. on upgrade, copy baseURL to defaultBaseURL if that option doesn't exists.

At the moment, I don't know where to do any of that. Still searching.

Edit: the commit you linked is exactly what I meant, this only fixes the situation for the installer, not the upgrade.

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

Re: 1.6->1.7: blogurl missing

Post by onli » Sun May 12, 2013 4:23 pm

Ok Ian. You know the drill, so I will just write it down.

First, if possible, do a complete backup of that devblog so we can repeat that!

Then, Please fetch the newest master from github.

In include/admin/upgrader.inc.php, change in line 164

Code: Select all

               array('version'   => '1.7-rc2',
                     'type'      => 'TEMPLATE_NOTICE',
                     'function'  => '',
                     'title'     => '<b>TEMPLATE_NOTICE:</b> The template file "entries.tpl" needs a specific assignment',
                     'desc'      => 'To transport the $entry variable to sub-templates like comments.tpl and trackbacks.tpl.
                     All internal and spartacus templates have been updated, so make sure you are using a recent version of your blog\'s template.
                     If you have your own custom template, be sure within your {foreach from=$dategroup.entries item="entry"} loop has this line after it:
                     <strong>{assign var="entry" value=$entry scope="parent"}</strong>'),
to

Code: Select all

               array('version'   => '1.7-rc2',
                     'type'      => 'TEMPLATE_NOTICE',
                     'function'  => 'serendipity_copyBaseURL',
                     'title'     => '<b>TEMPLATE_NOTICE:</b> The template file "entries.tpl" needs a specific assignment',
                     'desc'      => 'To transport the $entry variable to sub-templates like comments.tpl and trackbacks.tpl.
                     All internal and spartacus templates have been updated, so make sure you are using a recent version of your blog\'s template.
                     If you have your own custom template, be sure within your {foreach from=$dategroup.entries item="entry"} loop has this line after it:
                     <strong>{assign var="entry" value=$entry scope="parent"}</strong>'),
=> Setting serendipity_copyBaseURL as function to the upgrade task.

In include/functions_upgrade.inc.php, add this function to the bottom:

Code: Select all

/**
 * baseURL is now defaultBaseURL in the database, so copy if not already set
 *
 * */
function serendipity_copyBaseURL() {
    global $serendipity;
    if (serendipity_get_config_var("defaultBaseURL") === false && serendipity_get_config_var("baseURL") !== false ) {
        serendipity_set_config_var("defaultBaseURL", serendipity_get_config_var("baseURL"));
    }
}
If there is a basic error, you know how to fix it, code is untested. Then, copy those files over the devblog (=do an upgrade). If everything works, afterwards in the database, defaultBaseURL should be set and the bug should not occur.

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

Re: 1.6->1.7: blogurl missing

Post by Timbalu » Sun May 12, 2013 4:40 pm

...Really...? I do not want to update this tricky old installation..., I need it... :cry: At least not now...! [And I never had problems with this issue myself, (until now...) :roll: ]

But, if that helps, I will install a total new one.... (but this could be done by you either)
http://prdownloads.sourceforge.net/php- ... z?download
Regards,
Ian

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

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

Re: 1.6->1.7: blogurl missing

Post by onli » Sun May 12, 2013 5:16 pm

Well, my hunch was wrong. Although the fix works, the value gets copied and appears in the backend (not without the fix) and should be integrated anyway, even without the fix i can't reproduce the bug with a fresh 1.6-install upgraded to 1.7.

The code in serendipity_load_configuration gets its keys out of the database, if baseURL is set, it should be loaded despite the name-change in the frontend. I don't know why that sometimes don't work (issues with the authorid? It gets overwritten? PHP-version or database dependent?)

So, i will now make a proper task and ask garvin if he objects to commiting it and just hope that it will fix the bug anyway.

ju
Regular
Posts: 50
Joined: Wed Oct 01, 2008 4:27 pm

Re: 1.6->1.7: blogurl missing

Post by ju » Sun May 12, 2013 6:24 pm

I started reading this thread only after the update 1.6 to 1.7 and I can confirm that the "URL to Blog" field in http://www.example.com/serendipity_admi ... figuration is empty. But up to now I haven't seen any negative consequences.

If one of you wants to examine backuped files I can offer my daily sql-dumps plus daily backups of the files in the installation folder. But they are quite huge. You have been warned ;)

My sql and php knowledge is not enough to check myself. I'm just a happy user of s9y and love it because ist "just works".

The upload path is "uploads/" in both places in my installation (and I think that this has not changed).

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

Re: 1.6->1.7: blogurl missing

Post by yellowled » Mon May 13, 2013 10:21 am

Timbalu wrote:Please don't leave it empty. It has consequences now, as we have heard by those users having trouble with this issue.
I surely wouldn't advise to leave it empty, either, but it can have consequences. I had it in my blog as well and only noticed it because onli asked about it. Didn't notice any issues before I filled it in again.

YL

Edit onli: Answer to a post of Timbalu i moved to http://board.s9y.org/viewtopic.php?f=2&t=19299 because mainly offtopic.
amazon Wishlist - Serendipity-Podcast (German only, sorry)

ju
Regular
Posts: 50
Joined: Wed Oct 01, 2008 4:27 pm

Re: 1.6->1.7: blogurl missing

Post by ju » Mon May 13, 2013 2:49 pm

just to add to the confusion:

my blog is running 1.7 (at least it says so), the "URL to blog" field is empty in the admin-interface and in the db I find only baseURL (no defaultBaseURL). I have selected "Autodedect used HTTP-Host: Yes"

Code: Select all

mysql> select name, value from sy_config WHERE name = 'baseURL' OR name = 'defaultBaseURL';
+---------+--------------------------+
| name    | value                    |
+---------+--------------------------+
| baseURL | http://www.queernews.at/ | 
+---------+--------------------------+
1 row in set (0.01 sec)

mysql> 

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

Re: 1.6->1.7: blogurl missing

Post by Timbalu » Mon May 13, 2013 3:24 pm

This is my default in S9y 1.7 - IMHO it should not be plain 'baseURL' any more...

Code: Select all

defaultBaseURL        http://domain/blog/      0
autodetect_baseURL    false	                 0
Do you also have authorid = 0?

Maybe the "autodetect" option points to the missing issue link...
Regards,
Ian

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

Post Reply