Log in

View Full Version : The change in [CODE] to [code] in the entire database


tomko111
09-27-2010, 09:16 AM
Just like in the topic, what do I need to send a query to the database to change already existing posts in [CODE] (capitalized) in the tags [code] (written with a little)? Since the modification of the downloaded code markup to cover up for not logged users, while the code is not visible to everyone.

kh99
09-27-2010, 02:58 PM
I think something like:

UPDATE post
SET pagetext=REPLACE(pagetext, '[_CODE]', '[_code]')
WHERE pagetext LIKE '%[_CODE]%'

You need to remove the '_' characters, and also add your prefix to in front of 'post' if you have one, of course.

I tried this on my test site, but I'm not an expert in SQL or anything really so I would highly recommend backing up your database first.

tomko111
09-27-2010, 07:43 PM
It's not working... :(

kh99
09-27-2010, 07:46 PM
Did you remove the underscores and add your table prefix?

If you did then I don't know, I tried it and it worked for me. I did have an issue where it didn't show up right away, I think because of post caching.

Also, you would have to run a second query to change the [/code] tags but technically you didn't ask about that. :)

tomko111
09-28-2010, 08:01 AM
Oh, yes, thanks that's working!

And one more question: Where can I change option: if I click sharp/mark it will display [*code] not [*CODE] as it is by design?

Thank you!