A few years back I thought I would take [youtube] out of the BBCode tag database and replace it with the improved [y] tag. For whatever reason I thought removing the tag wouldn't affect any posts that had already been posted, but of course, big mistake, all the existing [youtube] objects in all the past posts stopped working instantly. After a moment of panic I thought, ok, no big deal, I'll just put [youtube] back in the BBCode database, everything will go back to normal. But no, the existing posts, once broken, no longer functioned at all. Example:
viewtopic.php?f=16&t=5894&start=480#p73009On the other hand, if I were to make any minor edit to that post, upon hitting the Submit button the [youtube] tags will suddenly function again. (Yes, the [youtube] tag still exists, it's just not publicly visible, but it works if placed in new posts.)
Knowing next to nothing about programming, I have no idea what causes this, but if I had to completely guess, it would be something like this:
When you create a BBCode tag, you're adding it to a list of tags in phpBB, and my guess is that each new tag gets assigned an internal reference number, or function, or script, but we'll say number. So for example [youtube] is 25. [y] is 26.
Then when you post a message that has an video related tag, at the time you submit the message, internally the post itself is marked up with hidden codes that say something like, "use tag 25 in this location." phpBB reads that command when building the webpage and viola, a youtube clip is linked. But when I removed the [youtube] tag from the database, reference number 25 got nulled out. Yet all the existing posts still said, play video X with tag 25, but there was no tag 25 anymore, so they didn't work. Then I recreated the [youtube] tag, thinking that would just revert everything back. But even though it had the same name as before, it got a brand new tag number, say [youtube] = 27. So even though the old posts were in plaintext asking for [youtube] to be played, which seems like it should work, in their hidden codes they were still asking for the non-existent tag 25 to be played, which was no good. However, if we physically edit an old post, with any edit at all, it causes the post to be "recompiled" from scratch, and that updates the tag number to 27, causing the post to work again.
What I'm leading up to is saying that in our current scenario, [Video] is 40, [Vimeo] is 50, [dm] is 51 and so on. If I just do a search and replace on the text, it won't replace the tag number, and so the posts won't work any more. If I knew the internal tag number of each video tag (or whatever the probably much more complicated mechanism is), I could maybe do a search and replace on that, but it's not as simple as a straightforward text search. There would have to be conditional logic along the lines of:
- Code: Select all
IF the text is [Video]Vimeo url[/Video] THEN replace that text with [vimeo]unique portion of url[/vimeo] AND replace "40" with "50" ELSEIF the text is [Video]dailymotion url[/Video] THEN replace that text with [dm]unique portion of url[/dm] AND replace "40" with "51" ELSEIF the text is [Video]youtube url[/Video] THEN replace that text with [y]unique portion of url[/y] AND replace "40" with "26".
Which is a little more complex than a plain find and replace, and me not being a programmer or knowing MySQL, I would with high probability completely destroy the underlying database.