Jump to content


Photo

post_order_column


I haven't NOTICED this being a problem, but, something is itching in my brain that it may wind up being one..

We have removed the post_order_column setting, apparently. Which.. Seems to me that might cause some problems with conversions, but.. The only one I ran into, they had a conversion done before, and when they upgraded to 3.3.2, because the setting was removed, it knocked their sort on converted topics off. Because, we had changed it to sort by post_date rather than pid to get them to sort right originally. Not an issue, changing it to descending solved it.. But, something tells me there might be a case where this is an issue..

BUT.. The main thing is this..

        if ( $this->settings['post_order_column'] != 'post_date' )
        {
            $this->settings[ 'post_order_column'] =  'pid' ;
        }

That's from rebuildTopic, but.. That code or similar is floating around elsewhere as well..

Since there is no longer a post_order_column setting, it's forcing it to PID

And.. This is a problem. I have one of those sites right now, where the PIDs are incorrect, and it has to be sorted by post_date.. Well, there is no more post_order_column, so, it's never going to be post_date, which means it's forced to PID.

So, when you resynch topics, it's always showing the FIRST topic as the 'last_post', so, if you have archiving enabled, since it keys on the last_post column, it's going to archive any topic that was STARTED before the time that it's set to archive based on when the last reply was.

Long story short.. You have archiving set to anything with no replies in over 1 year. This is a convert, so, PID 500 is 1/1/2005, PID 300 is the same topic, a reply dated today

When you resynch, it's going to set the topic table last_post of 1/1/2005.. That topic will be archived when it shouldn't be.

Status: Fixed
Version: 3.3.2
Fixed In: 3.3.3


8 Comments

We haven't removed completely the setting, it's been moved as a "power setting" in core.php.

Adding this in conf_global.php can bring back the correct sorting:
$INFO['post_order_column'] = 'post_date';
Actually I'm going to confirm this bug, we should check if the user has this setting set on post date and show at least some kind of warning to add this in conf_global.php if they need it (example: conversions).
I had the same problem and putting $ INFO ['post_order_column'] = 'post_date', in conf_global, the order was good but against the dates and the author of the early topics are reversed with the date and the author of last post !
I'll assume that the ticket I have right now is pkoipas78's.. Sounds exactly the same.

problem is this in the rebuild.

            $first_post = $this->DB->buildAndFetch( array(  'select'    => 'p.post_date, p.author_id, p.author_name, p.pid',
                                                            'from'        => array( 'posts' => 'p' ),
                                                            'where'        => 'p.pid=' . intval( $minMax['min'] ),
                                                            'add_join'    => array( array( 'select'    => 'm.member_id, m.members_display_name',
                                                                                         'from'        => array( 'members' => 'm' ),
                                                                                         'where'    => "p.author_id=m.member_id",
                                                                                         'type'        => 'left' ),
                                                                                  array( 'select'    => 'tp.pid as has_poll_id',
                                                                                         'from'        => array( 'polls' => 'tp' ),
                                                                                         'where'    => 'p.topic_id=tp.tid',
                                                                                         'type'        => 'left' ) )
                                                   )      );

Whether you're sorting by post_date or PID, it's using the max/min values.. Which.. If you're sorting by post date.. Ain't gonna fly.

the "Started by" section is the problem.. Seems to me there SHOULD be a problem in the 'last post' area as well.. And, I may just not see this on his site, because it may work out right, or someone might have posted to this topic after the conversion..
Thank you Jason ;-)
Matt: I have changed a bit the code and replaced it with 2 getPosts calls as you don't even check the order either in that query (and you don't even check it for the archived posts).

I have also noticed that it should actually use the option "onlyVisible" instead of "onlyViewable" or am I missing something? We still need to look into adding a warning in the upgrader as well.
Photo
Marcher Technologies
May 17 2012 12:07 AM
as a note... this hits CCS because lack of any definition.
LEFT JOIN reputation_cache rep_cache ON ( rep_cache.app='forums' AND rep_cache.type='pid' AND rep_cache.type_id=p.pid ) WHERE queued IN (1,2,0) AND p.pid <> 538 AND p.topic_id=27 ORDER BY asc LIMIT 0,25
Yes, it should use 'onlyVisible' so I've made that change.

Not sure how we can add a warning on the upgrader, though?