Issues with Removing then re-adding a custom BBCode

Discussion forum for MOD Writers regarding MOD Development.
Locked
User avatar
primehalo
Former Team Member
Posts: 2850
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Issues with Removing then re-adding a custom BBCode

Post by primehalo »

So an admin removes a custom BBCode and then re-adds it, but doing so caused an issue where the posts with that BBCode made prior to the removal no longer do the substitution for the BBCode. Any ideas why? I know removing then re-adding a BBCode would give it a different ID number, but I don't see how that should affect the functionality. As far as I know, the bbcode_uid is attached to the post, not a specific BBCode.
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!

User avatar
A_Jelly_Doughnut
Former Team Member
Posts: 34457
Joined: Sat Jan 18, 2003 1:26 am
Location: Where the Rivers Run
Contact:

Re: Issues with Removing then re-adding a custom BBCode

Post by A_Jelly_Doughnut »

The UID is attached to a post, but there is also the bbcode_bitfield attached to a post, and that is what is causing the issues...the bitfield stores the IDs of the BBCodes which are used in that post for efficiency upon viewing the post (fewer regular expressions applied)
A Donut's Blog
"Bach's Prelude (Cello Suite No. 1) is driving Indiana country roads in Autumn" - Ann Kish

User avatar
primehalo
Former Team Member
Posts: 2850
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: Issues with Removing then re-adding a custom BBCode

Post by primehalo »

I see... I didn't know about the bbcode_bitfield. I searched for more information about this bitfield and came up with this page: http://area51.phpbb.com/phpBB/viewtopic ... 26&t=28439

It sounds like the BBCodes used within a post are stored in the bitfield so that when the post is displayed not every BBCode has to be parsed, just the ones that are actually used in the post. This makes sense.

But it also sounds like the BBCodes are stored in the bitfield according to their ID number, not their tag name. Why is this done? Why not store them by bbcode_tag?

Storing by ID seems like it would cause issues. If you deleted a custom BBCode, and then later re-added it, none of the original posts made with that BBCode would parse it correctly because it has a different ID. And that would really blow If you had 1000's of posts using that BBCode.

Also, it would also mean if a custom BBCode was deleted, then a new one was immediate added (such that it now has the ID of the deleted one), all posts that contain the deleted BBCode would get parsed for the new BBCode.

I know there must be some reason for it that I'm not thinking of, as the phpbb3 programmers practically geniuses. Can someone break it down for me?
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!

User avatar
A_Jelly_Doughnut
Former Team Member
Posts: 34457
Joined: Sat Jan 18, 2003 1:26 am
Location: Where the Rivers Run
Contact:

Re: Issues with Removing then re-adding a custom BBCode

Post by A_Jelly_Doughnut »

Two things:
1) BBCode IDs are never reused.
2) The system by which bitfields are generated only supports integers.

EDIT: I should add that most people will probably only rarely change the custom BBCodes after the first few weeks of running the board.

Additionally, it isn't too terribly difficult to re-index the posts should the bitfields need changing.
A Donut's Blog
"Bach's Prelude (Cello Suite No. 1) is driving Indiana country roads in Autumn" - Ann Kish

User avatar
primehalo
Former Team Member
Posts: 2850
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: Issues with Removing then re-adding a custom BBCode

Post by primehalo »

A_Jelly_Doughnut wrote:Two things:
1) BBCode IDs are never reused.
2) The system by which bitfields are generated only supports integers.

EDIT: I should add that most people will probably only rarely change the custom BBCodes after the first few weeks of running the board.

Additionally, it isn't too terribly difficult to re-index the posts should the bitfields need changing.
My tests showed that BBCodes do get reused, so if they're not supposed to then this might be a bug. I added a BBCode spoiler and it received a bbcode_id of 13. I then deleted it and added a BBCode hilight, which was assigned a bbcode_id of 13.

I saw that bitfields where integers, but I guess my question was more why use a binary "bbcode_bitfield" column instead of a BLOB "bbcodes_used" column (like b|quote|list)? What is its advantage?

How do you re-index the posts when bitfields need changing?
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!

User avatar
A_Jelly_Doughnut
Former Team Member
Posts: 34457
Joined: Sat Jan 18, 2003 1:26 am
Location: Where the Rivers Run
Contact:

Re: Issues with Removing then re-adding a custom BBCode

Post by A_Jelly_Doughnut »

Hm...

ID reuse is governed by the database, and my prior tests with MySQL have indicated that IDs would not be used...this must have changed for the newer versions, because I get the same behavior you do on the latest version of the 5.0.x branch. So I stand corrected on that point.

The integer bitfield is considerably faster than a string-based bitfield would be.

There is no function built into phpBB to reparse posts, but the essence is to select the post data from the database, generate_text_for_edit(), generate_text_for_storage(), and update the database record.
A Donut's Blog
"Bach's Prelude (Cello Suite No. 1) is driving Indiana country roads in Autumn" - Ann Kish

Tmac
Registered User
Posts: 141
Joined: Wed Dec 13, 2006 4:54 am

Re: Issues with Removing then re-adding a custom BBCode

Post by Tmac »

EDIT: I should add that most people will probably only rarely change the custom BBCodes after the first few weeks of running the board.
Over time problem tend to build UP. The old way worked fine. :(

I want to make some changes but dont want my forum to be a frankenstein. Even some old bbcodes i had on 2.0 doesnt display, (because i added then after importing)

It doesnt sound reasonable edit some 100k posts after each bbcode modification.

User avatar
perldude69
Registered User
Posts: 41
Joined: Sat Apr 08, 2006 12:05 am

Re: Issues with Removing then re-adding a custom BBCode

Post by perldude69 »

I agree, editing thousands of posts is not reasonable. I have a Google Video and YouTube mod in my phpbb2 forum. I have thousands of entries with this mod.
I am working with RC7,so to say, getting ready for the big upgrade, and so far have only got my videos to work after manually editing a post, and then saving it without changes.
This somehow allows the BBcode to parse??? WTF

I thought the phpbb boys were on it.... OK, how do I easily reindex all of my posts?

--Perldude69

Tmac
Registered User
Posts: 141
Joined: Wed Dec 13, 2006 4:54 am

Re: Issues with Removing then re-adding a custom BBCode

Post by Tmac »

perldude69 wrote: I thought the phpbb boys were on it.... OK, how do I easily reindex all of my posts?

--Perldude69

I keep asking myself. How something like that passed? Thats a major set back from previous board version.

Mr. Flay
Registered User
Posts: 7
Joined: Fri Nov 16, 2007 8:15 pm

Re: Issues with Removing then re-adding a custom BBCode

Post by Mr. Flay »

So recreating custom bbcodes will break the existing 800k posts on our site? That's totally insane and unacceptable, unless there's a way to reassign old bbcode ids to the new ones under phpBB3.

User avatar
ameeck
Former Team Member
Posts: 6559
Joined: Mon Mar 21, 2005 6:57 pm

Re: Issues with Removing then re-adding a custom BBCode

Post by ameeck »

I'm not sure about this, and would like to have it confirmed, but look into the CVS version of phpBB, into the develop directory, there is a file called adjust_bbcodes.php there, which looks like it's capable of doing the reindexing.

Caution: This is CVS code and be sure to try it on a dry-run first with backups, I guess official support won't cover this. Also the script might be a memory-muncher...

Locked

Return to “[3.0.x] MOD Writers Discussion”