Our forum is based on phpbb3 and for sometime we have been using a syntax highlight mod. We’ve decided to drop the mod and return to the basic bbcode tags. Long story short – I need to update mySQL fields (phpbb_forum_posts, post_text) that contain:
Text Text Text Text Text
[swordfish filename=code.bas]
code code code
123
code code[/swordfish]
Text Text Text Text Text
To
Text Text Text Text Text
[code]
code code code
123
code code[/code]
Text Text Text Text Text
It is worth highlighting that [swordfish filename=code.bas] could contain other fields such as [swordfish filename=code.bas abc 123]. Regardless of what’s in the first tag, it needs to be changed to [code]
This is a bit out of my “need to know” scope, and I would really appreciate if someone could help design either a mySQL or PHP script to achieve a mass update. (I know my way around the basics, not enough for advanced search/replace)
Here you go:
EDIT
Please note that the
REPLACEstatement is NOT complete! You would have to fetch every column and write it back (not just the two I mentioned).