category_left and category_right // per category rss

Found a bug? Tell us!!
Post Reply
mjollnir
Posts: 3
Joined: Tue Jun 24, 2008 8:41 am

category_left and category_right // per category rss

Post by mjollnir »

hey there

Since upgrading to 1.3.1 I have just noticed that per category rss seems to be broken....

I think I've traced it down as far as category_left and category_right, but I'm not sure.

I have the following data in my category table:

http://paste.dollyfish.net.nz/cc916b

This looks strange to me. I would have thought it would have had null, 7 and 6, null respectively in those two rows.

At any rate, serendipity_fetchCategoryRange is returning 0, 0 though (category 6 is the one I'm trying to get at), and the rss feed ends up empty.

Also in the admin ui when I try to edit categories, they come up with no data pre-populated in the edit form. I wonder if this is because the category info isn't what is expected? I care about this less than suddenly having broken category rss though ;)
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: category_left and category_right // per category rss

Post by garvinhicking »

Hi!

How did you previously delete your categories? Hopefully not straight via SQL? There are several categories missing...when s9y deleted them, it recreated the proper left and right IDs...?!

You should be able to fix this if you correct it to this syntax:

Catgory #6 needs to have left 1 and right 2
Category #7 needs to have left 3 and right 4

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/
mjollnir
Posts: 3
Joined: Tue Jun 24, 2008 8:41 am

Re: category_left and category_right // per category rss

Post by mjollnir »

garvinhicking wrote:Hi!

How did you previously delete your categories?
I didn't delete any categories.
garvinhicking wrote: Catgory #6 needs to have left 1 and right 2
Category #7 needs to have left 3 and right 4
Sorry, that is exactly what they do have already (have a look at http://paste.dollyfish.net.nz/cc916b) - if that is actually correct then I really don't know why per category rss is failing.

Looking at the following code in serendipity_fetchCategoryRange:

$res =& serendipity_db_query("SELECT category_left, category_right, hide_sub FROM {$serendipity['dbPrefix']}category WHERE categoryid='". (int)$categoryid ."'");
error_log("id is $categoryid");
error_log(print_r($res, true));


I get:

id is 6
Array
(
[0] => Array
(
[category_left] => 0
[category_right] => 0
)

)

but given what I just showed you in that paste bin link, I can't understand how that result is being returned.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: category_left and category_right // per category rss

Post by garvinhicking »

Hi!

Oh, I'm sorry. I misread your nopaste script! Indeed the input there is correct.

What happens if you issue this query in your MySQL:

Code: Select all

SELECT category_left, category_right, hide_sub FROM s9ycategory WHERE categoryid='6'";
Somehow I believe your output doesn'T fit the SQL query -- you only get 2 result indexes (0, 0 for both category) but are missing the third index "hide_sub".

So I rather believe this is the underlying problem, that your SQL table is missing the "hide_sub" column. Usually it should have been inserted by the updated, but you should be able to add this manually now:

Code: Select all

ALTER TABLE s9ycategory ADD COLUMN sort_order int(11);
ALTER TABLE s9ycategory ADD COLUMN hide_sub int(1);
HTH,
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/
mjollnir
Posts: 3
Joined: Tue Jun 24, 2008 8:41 am

Re: category_left and category_right // per category rss

Post by mjollnir »

garvinhicking wrote:Hi!
Somehow I believe your output doesn'T fit the SQL query -- you only get 2 result indexes (0, 0 for both category) but are missing the third index "hide_sub".
oh you're right. I added those manually and now it seems to work. Is this a bug in the upgrade? (I'm using postgres, not mysql)

That fixed it anyway. Cheers.
Post Reply