Warning: The author of this contribution does not provide support for it anymore.

Change Post Time

Time error - Change Post Time

Time error

by HiFiKabin » Fri Sep 09, 2016 9:03 am

Strange error I am getting. If I change a post time so that two posts are reversed, viewtopic shows them in the new order, viewforum doesn't.

Image

Image

Scooters post was first (and in another topic) Jazz Club started a new topic and I moved Scooters post, adjusting the time to place them in the correct time order.

I tried purging the cache, but it didn't make any difference.

Any thoughts on this?

phpBB 3.1.9
User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 6817
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James

Re: Time error

by javiexin » Fri Sep 09, 2016 9:28 am

It might very well be a limitation on the extension. Unfortunately, I do not have the time (and energy) to try such changes.

Sorry I cannot be of more help.
-javiexin
User avatar
javiexin
Code Contributor
Posts: 1157
Joined: Wed Oct 12, 2011 11:46 pm
Location: Madrid, Spain
Name: Javier

Re: Time error

by mamba » Sun Dec 25, 2016 12:44 am

Probably happening because viewforum is looking at the post numbers, not the post times.
Using latest version of PHPBB
User avatar
mamba
Registered User
Posts: 604
Joined: Thu Jan 16, 2003 7:59 pm
Location: Australia

Re: Time error

by javiexin » Thu Jan 19, 2017 4:48 pm

HiFiKabin wrote:Strange error I am getting. If I change a post time so that two posts are reversed, viewtopic shows them in the new order, viewforum doesn't.

Image

Image

Scooters post was first (and in another topic) Jazz Club started a new topic and I moved Scooters post, adjusting the time to place them in the correct time order.

I tried purging the cache, but it didn't make any difference.

Any thoughts on this?

phpBB 3.1.9
Ok, I have now tracked down the issue, and it definitely comes from a core function not working as expected (specifically, the sync function in includes/functions_admin.php.

From my point of view, the extension code is ok, IF the core would behave as expected/documented.

Now, I will try to see what the is the core change required, and propose it for evaluation.

-javiexin
User avatar
javiexin
Code Contributor
Posts: 1157
Joined: Wed Oct 12, 2011 11:46 pm
Location: Madrid, Spain
Name: Javier

Re: Time error

by HiFiKabin » Thu Jan 19, 2017 4:56 pm

Thanks for your persistence Javier.
User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 6817
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James

Re: Time error

by javiexin » Thu Jan 19, 2017 10:37 pm

HiFiKabin wrote:Thanks for your persistence Javier.
Your welcome. Unfortunately, not very good news to share. I have seen now what is the issue.
mamba wrote:Probably happening because viewforum is looking at the post numbers, not the post times.
Precisely, but not in viewforum, but in the internal sync method (the last post is stored in the forums table).

The core is assuming that the highest post_id is the latest, and hence, updating the forums with this information. If a post is moved in the time sequence (as done by this extension), this assumption might not be true any longer, as a post with a lower post_id might have been moved after the highest post_id, and the highest post id might have been moved before the next highest post id.

I have seen two possible solutions, both of them not quite what I would like. Here they go, with the big issues they might bring:
  • Change the core to use the latest post_time instead of the highest post_id to select the last post for a forum. This would be ok, except for the fact that doing so, the actual query to sync the posts would be much less performant, as it would not be possible to use the post_id index. Adding an extra index to the posts table just for this would be overkill.
  • Change the post id of the post that should be latest, to increase it. This might be ok, except for the fact that this would require to sync the whole set of tables that refer to posts, and also, it would break any external links that point to that post; creating a copy of this post with a new id would have almost the same issues as changing the post itself.
And changing the last_post from the extension is not good either, as any new synchronization will remove the change, and we will be back to square one.

So, given the situation, I think the best solution is not doing anything... Let it stay as is, as the cases where this might happen are very rare, and usually, they would solve themselves as soon as a new post is written in the "unsync" forum. Otherwise, we would compromise performance (long query without index to resync), or reliability (risk of something going out of order when updating, and most importantly, external links would not be kept).

Now, if anyone propose a viable alternative, I would be glad to look at it, and if feasible, implement it, either as a change in this extension, or as a proposal for change to the core.

Nothing else I can do unfortunately :(
Regards,
-javiexin

PS: One thing that I can do, with relative ease, is checking if the proposed change would create this issue, and either give a warning, or forbid it completely. Opinions?

EDIT: Looking at it again, I have seen that the index on post time already exists, so it might not be as bad as I figured first... Let me check.
User avatar
javiexin
Code Contributor
Posts: 1157
Joined: Wed Oct 12, 2011 11:46 pm
Location: Madrid, Spain
Name: Javier

Re: Time error

by Bruce Banner » Tue Feb 21, 2017 10:37 pm

Hi. I also just noticed this issue. I changed the order of a thread with three posts from 1, 2, 3 to 1, 3, 2 but 3 is still showing as the last post in viewforum instead of 2. Have you had any more luck with this?
Bruce Banner
Registered User
Posts: 1383
Joined: Thu Sep 25, 2014 10:36 am

Re: Time error

by javiexin » Tue Feb 21, 2017 10:41 pm

No luck, this is core behaviour.
User avatar
javiexin
Code Contributor
Posts: 1157
Joined: Wed Oct 12, 2011 11:46 pm
Location: Madrid, Spain
Name: Javier

Re: Time error

by Bruce Banner » Tue Feb 21, 2017 10:43 pm

javiexin wrote:No luck, this is core behaviour.
Oh well. Thanks anyway. :)
Bruce Banner
Registered User
Posts: 1383
Joined: Thu Sep 25, 2014 10:36 am

Re: Time error

by HiFiKabin » Wed Feb 22, 2017 9:40 am

Oakie dokie. Thanks for trying
User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 6817
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James