Remove obsolete bbcode from old posts

Get help with installation and running phpBB 3.2.x here. Please do not post bug reports, feature requests, or extension related questions here.
Post Reply
whocarez
Registered User
Posts: 131
Joined: Sat Apr 18, 2009 9:19 pm

Remove obsolete bbcode from old posts

Post by whocarez » Sat Feb 17, 2018 12:55 pm

Hello,
I upgraded my board to the actual version 3.2.2. Now I use this automatically embedding of videos, so I want to get rid of now obsolete bbcodes like [youtube], [media] or [video] in old posts. Is it possible to remove these old bbcodes via SQL from these posts? I can not do it by hand, because of more than 100k posts.

Probably I've got to reparse afterwards all the posts by running this command line, right?

Code: Select all

php bin/phpbbcli.php --safe-mode reparser:reparse --ansi

User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 2625
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.
Contact:

Re: Remove obsolete bbcode from old posts

Post by thecoalman » Sat Feb 17, 2018 2:34 pm

You can use REGEXP_REPLACE

Code: Select all

UPDATE phpbb_posts SET 
post_text = REGEXP_REPLACE
(

	post_text, 

	'your pattern', 

	'your replacement'
           
)
WHERE post_id = 12345
I'd strongly urge you to test locally on test database. The WHERE post_id = 12345 can be used to test on single post so you don't have to repopulate the whole test database after botched attempt, remove to work on whole database. Be sure to backup your live database before using it there.

"Your pattern" is a regex, check MySQL's documentation or whatever database you are using. "your replacement" can have placeholders from the regex pattern.

whocarez
Registered User
Posts: 131
Joined: Sat Apr 18, 2009 9:19 pm

Re: Remove obsolete bbcode from old posts

Post by whocarez » Sat Feb 17, 2018 2:43 pm

thanks, will try it in a save environment :-)

Post Reply

Return to “[3.2.x] Support Forum”

Who is online

Users browsing this forum: No registered users and 23 guests