Fix wrong topic_first_post_id

Get help with installation and running phpBB 3.2.x here. Please do not post bug reports, feature requests, or extension related questions here.
User avatar
Leinad4Mind
Translator
Posts: 863
Joined: Sun Jun 01, 2008 11:08 pm
Contact:

Fix wrong topic_first_post_id

Post by Leinad4Mind »

Hi guys,

so I've a 3.2 forum that was upgraded from a 3.0 (A very old one) and I've found an oddidity.

Since I've merged many topics into others for the last years, I've found today, while using Smart Subject Ext that for some topics where I've made some merges, the topic_first_post_id is not the 1st post.

My question now is, is there a safe way to fix this via SQL for all topics?

Thanks in advance!
Want to access all my portuguese MOD and Extension translations?
Become my Patreon!
phpBB Portugal Translator and Moderator
User avatar
stevemaury
Support Team Member
Support Team Member
Posts: 52768
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve
Contact:

Re: Fix wrong topic_first_post_id

Post by stevemaury »

To receive extension support please visit our Extensions Database and post in the specific extension's designated support area. The link to the support area for each released extension is also available in the first post of each released extension listed in the [3.2.x] Extension Database Releases forum. For extensions still in development (not recommended for a live board) support is in that extensions's topic in the Extensions in Development forum.
I can stop all your spam. I can upgrade or update your Board. PM or email me. (Paid support)
User avatar
Leinad4Mind
Translator
Posts: 863
Joined: Sun Jun 01, 2008 11:08 pm
Contact:

Re: Fix wrong topic_first_post_id

Post by Leinad4Mind »

It's not extension support. Please read it carefully.
Want to access all my portuguese MOD and Extension translations?
Become my Patreon!
phpBB Portugal Translator and Moderator
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53411
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Fix wrong topic_first_post_id

Post by Brf »

Try syncing the forum the topic is in.
User avatar
Leinad4Mind
Translator
Posts: 863
Joined: Sun Jun 01, 2008 11:08 pm
Contact:

Re: Fix wrong topic_first_post_id

Post by Leinad4Mind »

Thanks Brf, that was a good idea, but didnt do the trick. :(

EDIT: I've found this topic with a script that should do the trick :)

viewtopic.php?f=46&t=2167149#p13211174
Want to access all my portuguese MOD and Extension translations?
Become my Patreon!
phpBB Portugal Translator and Moderator
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53411
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Fix wrong topic_first_post_id

Post by Brf »

That is a 6-year-old topic. The forum sync is supposed to fix all that problem.
Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 28654
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: Fix wrong topic_first_post_id

Post by Paul »

Brf wrote: Tue Jul 17, 2018 1:17 pm That is a 6-year-old topic. The forum sync is supposed to fix all that problem.
No, sync doesn't handle first post info (The method also has his last major change 6 years ago, which was for soft delete which came in 3.1); https://github.com/phpbb/phpbb/blob/1b1 ... .php#L1295
The queries from that other topic should still work. Make sure to have a backup before running them ofcourse (And preferbly run them locally first).
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53411
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Fix wrong topic_first_post_id

Post by Brf »

Paul wrote: Tue Jul 17, 2018 2:18 pm No, sync doesn't handle first post info
Has this bug been reported and/or fixed in the next version then?
Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 28654
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: Fix wrong topic_first_post_id

Post by Paul »

I don't know if it is a bug as I have no idea how the topics where merged (And especially because it might be old data it might simply be a wrong upgrade in the past). It will need further investigation to see why the orignal merge was done wrong.
If you mean that the sync function is missing a feature, namely fixing first posts then I have no idea if that is a feature that is wanted. It is most definitly not a bug.
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53411
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Fix wrong topic_first_post_id

Post by Brf »

Is that not the purpose of resync? To set all the first and last post info and counts in the topics table?
Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 28654
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: Fix wrong topic_first_post_id

Post by Paul »

The current purpose of the sync function does not include the sync of the topic_first_post_id. I have no idea if it should have, but I don't think so as it is a very specific case that the topic_first_post_id is wrong.
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53411
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Fix wrong topic_first_post_id

Post by Brf »

It easily could happen if two topics were merged, or if the first post is deleted.
Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 28654
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: Fix wrong topic_first_post_id

Post by Paul »

If you merge a topic, or delete a post via the phpBB interface the function to handle the merge? If those function don't handle that correctly, then that is a bug and that should be reported (I haven't tested this, so not fully sure if there is a issue there).
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53411
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Fix wrong topic_first_post_id

Post by Brf »

Well, the resync is to handle problems, like if a crash happens for some reason before the topics table is updated. Otherwise, what is its purpose? If everything always works as it should, then there is no reason to have a resync. The resync should handle first-post as well as last-post, otherwise it is not that useful.
User avatar
Leinad4Mind
Translator
Posts: 863
Joined: Sun Jun 01, 2008 11:08 pm
Contact:

Re: Fix wrong topic_first_post_id

Post by Leinad4Mind »

That resync is great when we've orphan topics. It solves that problem atleast. But I agree with Brf, the resync should fix this problem I have.
And I'll try to make some tests soon to see if the merge tool is working as it should (updating the topic_first_post_id) and report back.
Want to access all my portuguese MOD and Extension translations?
Become my Patreon!
phpBB Portugal Translator and Moderator
Post Reply

Return to “[3.2.x] Support Forum”