How to find all raw HTML tags in xf_post table?


Well-known member
Over the decades we have moved from various forum software solutions to XF. Some our old posts have raw html tags in it. I would like to clean this up.

As we have millions of posts, its hard to find them all. Once I know which tags are used I can mass replace those to bb code by DB query. The most common ones like <H1> I can guess easy enough, but the more exotic ones and complex ones are close to impossible to guess.

Is there any way to scan the database and get a list if HTML tags used?
Depending on what all you want to scan, you would probably need a php script that runs either over a defined set of tables & colums or dynamically queries them from the information_schema tables. Then you can process the records with the strip_tags php function, or a more sophisticated dom interpreter if you want to convert some (or even the XF html to bb code parser).

MySQL language is probably not strong enough to do this on it's own, so a query might be possible, but it's gonna be rather complex and error prone, relying on multiple stacked functions, and possibly even slower than outsourcing to php.
Top Bottom