Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: alkisg on March 10, 2007, 01:56:41 AM

Title: Bug: boardindex doesn't show last post from (very) nested board
Post by: alkisg on March 10, 2007, 01:56:41 AM
Can someone confirm (or not!) this bug?
I have a somewhat nested hierarchy:
category1 > board1 > subboard1 > subboard2

The problem is that messages that get posted in subboard2 don't show up in the "last message" paragraph at the bottom of the home screen. They do show up everywhere else though, like, right next to board1 in the home screen, where it says "last message by (user) at (date).

Notice that subboard2 is twice nested (in subboard1 which is a child of board1).

I have SMF 1.1.2 somewhat modded (http://users.sch.gr/alkisg/tosteki). I'd like to know if anyone else sees this bug, so I can start debugging either the core smf or my packages...
Thanks.

P.S. If I go to the control panel and select to recount all statistics, then they do show up correctly on the home screen.
Title: Re: Bug? boardindex doesn't show recent message in (very) nested board
Post by: alkisg on March 10, 2007, 07:53:27 AM
Quote from: alkisg on March 10, 2007, 01:56:41 AM
They do show up everywhere else though, like, right next to board1 in the home screen, where it says "last message by (user) at (date).

Sorry, that is incorrect, it only displays correctly in its parent (=subboard1), not in its grandparent (=board1).

I'm thinking the bug is in Subs-post.php, function updateLastMessages.

I started debugging, but I'd appreciate it if someone confirmed the bug...
Title: Re: Bug? boardindex doesn't show recent message in (very) nested board
Post by: alkisg on March 10, 2007, 08:05:22 AM
I've confirmed the bug by posting in a nested category here:
http://www.simplemachines.org/community/index.php?topic=156741.0

It didn't show up in the board index.
Title: Re: Bug: boardindex doesn't show last post from (very) nested board
Post by: alkisg on March 10, 2007, 12:03:50 PM
The bug was indeed in function updateLastMessages:

Quote
   // Now commit the changes!
   foreach ($parent_updates as $ID_MSG => $boards)
   {
      db_query("
         UPDATE {$db_prefix}boards
         SET ID_MSG_UPDATED = $ID_MSG
         WHERE ID_BOARD IN (" . implode(',', $boards) . ")
            AND ID_MSG_UPDATED < $ID_MSG
         LIMIT " . count($boards), __FILE__, __LINE__);
   }
   foreach ($board_updates as $ID_MSG => $boards)
   {
      db_query("
         UPDATE {$db_prefix}boards
         SET ID_LAST_MSG = $ID_MSG, ID_MSG_UPDATED = $ID_MSG
         WHERE ID_BOARD IN (" . implode(',', $boards) . ")
         LIMIT " . count($boards), __FILE__, __LINE__);
   }

I've replaced the line in bold with

SET ID_LAST_MSG = $ID_MSG, ID_MSG_UPDATED = $ID_MSG


meaning, I made the $parent_updates the same as $board_updates, and everything works OK now.
But I think that a better fix is needed, so it'd be great if someone from the development team had a look at this.

Regards,
Alkis
Title: Re: Bug: boardindex doesn't show last post from (very) nested board
Post by: Max22 on September 11, 2008, 08:07:01 PM
Thank you for the fix. It seems work well in 1.1.6.
Title: Re: Bug: boardindex doesn't show last post from (very) nested board
Post by: Max22 on September 12, 2008, 10:35:15 AM
Quote from: Max22 on September 11, 2008, 08:07:01 PM
Thank you for the fix. It seems work well in 1.1.6.

My illusion, doesn't solve completely the issue... please search a better fix.
Title: Re: Bug: boardindex doesn't show last post from (very) nested board
Post by: metallica48423 on September 12, 2008, 03:45:20 PM
this is not technically a bug, it is completely intentional for performance reasons.

Title: Re: Bug: boardindex doesn't show last post from (very) nested board
Post by: Max22 on September 12, 2008, 05:04:50 PM
Quote from: metallica48423 on September 12, 2008, 03:45:20 PM
this is not technically a bug, it is completely intentional for performance reasons.

If it's intentional, can you give me an help to resolve this particular detail?