This is the sevent in a series of articles on my migration to WordPress. In this post, I’ll talk about how I updated some of the comments to deal with some tokens left over from the previous system.
Tokens? What tokens?
When I copied over the comments from my old system, I took the raw text. In hindsight now, as I type this, I think I could have injected the token values into the comments instead of just taking the raw text. Now, I have this in a comment:
Thanks for this summary! One thing I have to remind myself evey time I go to create further client certificates on my FreeBSD server is to start a bash shell before running those commnads as my default shell is out of the box csh (I think) – it may be that others hit this (simple) block… Simply start the shell (if installed from ports) by typing ‘bash’ before proceeding. [%sig%]
See that [%sig%]? That’s the Phorum token for the user’s signature. I want to get rid of that and replace it with something less obtrusive.
In my case, I want to change my signature to ‘The Man Behind The Curtain‘.
I have to do this very carefully. I will be updating a MySQL database which has no transactions. This is one basic reason why I wish WordPress used PostgreSQL, which, by default, has transactions.
Here is the SQL I came up with to verify what I wanted to do:
SELECT comment_ID, user_id, replace(comment_content, '[%sig%]', '-- \nThe Man Behind The Curtain') FROM wp_comments WHERE comment_content LIKE '%\[\%sig\%\]%' AND user_id = 1154;
Checking the output, I saw the expected results. So now I moved onto the UPDATE command:
UPDATE wp_comments\ SET comment_content = replace(comment_content, '[%sig%]', '-- \nThe Man Behind The Curtain') WHERE comment_content LIKE '%\[\%sig\%\]%' AND user_id = 1154;
That’s it. That’s all my comments updated. As you can see, I had user id 1154.
Now we need to update all the other users… Sadly, they will just lose their signatures.
UPDATE wp_comments\ SET comment_content = replace(comment_content, '[%sig%]', '') WHERE comment_content LIKE '%\[\%sig\%\]%';
The HTML tags
In previous posts, I thought I had some <HTML> tags to deal with. But as I search now, I can’t find any, neither in the comments nor in the posts.
I guess my work here is done. :)