Jump to content

Community

[[Template core/global/global/lkeyWarning does not exist. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme.]]
JayX

Broken quotes, images, links, avatar? Here's My Fixes

Recommended Posts

I upgraded from 3.4.x to 4.0 and noticed a lot of the old content of the forum didn't transition so great - lots of broken links, old bb code, unreadable quoting structures etc. So I've put together some find/replace MySQL queries to help with getting as much of my community back as possible. My site has been on IPB since 2.0.0 DPR1 according to my log, since 2004. I'm not going to lie - there were a lot of stranded files (hopefully mostly resolved with IPB 4 as I migrated to a fresh install base) and tons of extra crap in my SQL DB. This is not really the ideal way to migrate your site I'm sure, but my site isn't ideal anyway ;)

​Don't try any of this without backups - just because it worked for me doesn't mean it'll work for you and one bad line could break your site completely. 

 UPDATE `ibf_forums_posts`
 SET `post` = replace(post, "[quote name=", '<blockquote  class="ipsQuote" data-ipsquote="" data-ipsquote-username=')

                              
UPDATE `ibf_forums_posts`
 SET `post` = replace(post, "']", "'>")

                              
UPDATE `ibf_forums_posts`
 SET `post` = replace(post, "[/quote]", '</blockquote>')

These 3 SQL queries above are designed to convert broken Quotes from 3.4.x. I still have a ton of quotes in posts from versions before that that appear to be harder to fix, but possible (replace can't use wildcards which is what's screwing me). 

UPDATE `ibf_forums_posts`
 SET `post` = replace(post, "[code]", '<pre data-pbcklang="html" data-pbcktabsize="4" class="html ipsCode prettyprint">')     
 
 UPDATE `ibf_forums_posts`
 SET `post` = replace(post, "[/code]", '</pre>')   

These two are designed to replace the old 'code' bbcode that I use to put pieces of code in. Like I'm using here.

 UPDATE `ibf_forums_posts`
 SET `post` = replace(post, "[i]", '<em>')   
 
  UPDATE `ibf_forums_posts`
 SET `post` = replace(post, "[/i]", '</em>')  

This is another BB code fix - this time for italics. Bold works similarly, as well as underline, strikethrough etc. Just convert from bbcode on the left to html style on the right, and don't forget to do the second replace to fix the close tags.

UPDATE `ibf_forums_posts`
 SET `post` = replace(post, 'public/style_emoticons/<#EMO_DIR#>/unsure.gif', 'uploads/default_unsure.png.?????????.png')

With broken avatars, I fix them by looking at what the filenames in /uploads/ are for the default and switch out the broken URLs to the new one. IP4 adds random characters to the filenames now (presumably to stop abc.jpg overwriting a preexisting abc.jpg) so you'll have to do them one at a time whenever you find broken links.

UPDATE `ibf_forums_posts`
 SET `post` = replace(post, "[IMG]", '<img src="') 
 
 
   UPDATE `ibf_forums_posts`
 SET `post` = replace(post, "[/IMG]", '" class="ipsImage">') 

Designed to fix images - however on my original attempt I got a piece of code wrong and broke a few hundred posts so this fixed version will hopefully work. Backup, I forgot to and had progressed too far since the last one so just put it down to experience.

  UPDATE `ibf_forums_posts`
 SET `post` = replace(post, "[URL=", '<a href=')   
 
  UPDATE `ibf_forums_posts`
 SET `post` = replace(post, "[/URL]", '</a>')  

Likewise, this should fix links that have the old URL tags on them.

Feel free to contribute any extras or better versions of the ones I've had some success with. I still have issues with my archive posts, but they're a lot more readable now and I'm happy enough with that. 

Share this post


Link to post
Share on other sites

I think a lot of it is down to how many versions my site has been in over the years, as well as things like external scripts that haven't played nice. I'm by no means a particularly great administrator, and 10 years ago I was definitely worse! 

IP4.0 looks great to me, I so wish I was starting here with a clean database, but I know if I did that my site would die overnight. It's taken maybe a day to get my site that works fine 90% of the time for 90% of the users, and most errors beyond that will be a dead end link to an emoticon that's been moved and forgotten about. 

Share this post


Link to post
Share on other sites

Everything should transition fine (though note that posts convert in the background after upgrading). I would not recommend running those queries, some are far too broad in scope and many will interfere with the correct converting of post data.

If, after upgrading, and posts have finished converting, you are experiencing issues, please submit a support request so we can figure out what's happening and include a fix in the software itself if necessary.

Share this post


Link to post
Share on other sites

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...