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: 852
Joined: Sun Jun 01, 2008 11:08 pm
Contact:

Fix wrong topic_first_post_id

Post by Leinad4Mind » Mon Jul 16, 2018 10:29 pm

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: 50871
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 » Mon Jul 16, 2018 10:50 pm

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.
For REALLY good and VERY inexpensive hosting CLICK HERE

I can stop all your spam. I can upgrade or update your Board. PM or email me. (Paid support)

User avatar
Leinad4Mind
Translator
Posts: 852
Joined: Sun Jun 01, 2008 11:08 pm
Contact:

Re: Fix wrong topic_first_post_id

Post by Leinad4Mind » Mon Jul 16, 2018 10:54 pm

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: 51873
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Fix wrong topic_first_post_id

Post by Brf » Mon Jul 16, 2018 11:30 pm

Try syncing the forum the topic is in.

User avatar
Leinad4Mind
Translator
Posts: 852
Joined: Sun Jun 01, 2008 11:08 pm
Contact:

Re: Fix wrong topic_first_post_id

Post by Leinad4Mind » Tue Jul 17, 2018 9:15 am

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: 51873
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Fix wrong topic_first_post_id

Post by Brf » Tue Jul 17, 2018 1:17 pm

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: 25455
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 » Tue Jul 17, 2018 2:18 pm

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).
Knock knock
Race condition
Who's there?

My BlogMy Photosmy phpBB Extensionscustom phpBB work & Development

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51873
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Fix wrong topic_first_post_id

Post by Brf » Tue Jul 17, 2018 2:43 pm

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: 25455
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 » Tue Jul 17, 2018 2:46 pm

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.
Knock knock
Race condition
Who's there?

My BlogMy Photosmy phpBB Extensionscustom phpBB work & Development

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51873
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Fix wrong topic_first_post_id

Post by Brf » Tue Jul 17, 2018 2:52 pm

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: 25455
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 » Tue Jul 17, 2018 2:56 pm

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.
Knock knock
Race condition
Who's there?

My BlogMy Photosmy phpBB Extensionscustom phpBB work & Development

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51873
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Fix wrong topic_first_post_id

Post by Brf » Tue Jul 17, 2018 2:57 pm

It easily could happen if two topics were merged, or if the first post is deleted.

Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 25455
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 » Tue Jul 17, 2018 3:08 pm

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).
Knock knock
Race condition
Who's there?

My BlogMy Photosmy phpBB Extensionscustom phpBB work & Development

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51873
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Fix wrong topic_first_post_id

Post by Brf » Tue Jul 17, 2018 3:13 pm

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: 852
Joined: Sun Jun 01, 2008 11:08 pm
Contact:

Re: Fix wrong topic_first_post_id

Post by Leinad4Mind » Tue Jul 17, 2018 5:31 pm

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”