• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.1 A lot of "code" is showing after conversion

#1
Hello,

I've managed to convert 714K posts from SMF to xenForo but it has not been without issues. One of the issues I am currently experiencing is that a lot of posts are showing "code" instead of outputting the desired result. I have attached an annotated screenshot for reference (NOTE: There may be some foul language in the topic, in case anyone is sensitive to that)

Is there a way to fix this or am I out of luck?

Any help would be appreciated.
 

Attachments

Jake Bunce

XenForo moderator
Staff member
#6
Run this query to fix the <br /> tags:

Code:
UPDATE xf_post
SET message = REPLACE(message, '<br />', '\n');
For the single quote entities:

Code:
UPDATE xf_post
SET message = REPLACE(message, '&#039;', '\'');
For the double quote entities:

Code:
UPDATE xf_post
SET message = REPLACE(message, '&quot;', '"');
The quote and size tags require you to install this addon:

http://xenforo.com/community/threads/post-content-find-replace.6548/

For the size tags use this to simply remove the tag:

Quick Find: [size

Regular expression: #\[size=([\d]+)pt\]([^\[]+)\[/size\]#siU

Replacement String: \2

Screen shot 2011-12-05 at 6.34.14 PM.png

For the quote tags use this:

Quick Find: [quote

Regular expression: #\[quote author=([a-z0-9_ \-]+) link=([^\]]+)\]([^\[]+)\[/quote\]#siU

Replacement String: [quote="\1"]\3[/quote]

Screen shot 2011-12-05 at 6.45.55 PM.png
 
#7
Jake, first I want to thank you for posting those suggestions. Second, I'm really scratching my head over here. I followed each step of your post and I'm not seeing the results. When I run the queries, mySQL tells me that "0 rows affected." I also spent a ton of time running the Post Content Replacement Tool, but I don't see the results in any of my posts. Any idea what might be going on?
 

Jake Bunce

XenForo moderator
Staff member
#8
I tested all of those queries and regexes by recreating your posts on my forum. It should work.

But I see now that some of that stuff is in signatures. Here are queries for the signatures:

Code:
UPDATE xf_user_profile
SET signature = REPLACE(signature, '<br />', '\n');

UPDATE xf_user_profile
SET signature = REPLACE(signature, '&#039;', '\'');

UPDATE xf_user_profile
SET signature = REPLACE(signature, '&quot;', '"');
But Kier's addon only does posts, not signatures. The addon would have to be modified to get the BB codes in signatures.
 
#9
Thank you! I applied those queries and saw the results in my original thread. It could be that I'm not seeing the Post Content Replace Tool changes because I wasn't looking at a thread where it would have been an issue?

What about something like the image below?

 

Jake Bunce

XenForo moderator
Staff member
#10
Hmm, nested quotes...

Try this:

Quick Find: [quote

Regular expression: #\[quote author=([a-z0-9_ \-]+) link=([^\]]+)\](.+)\[/quote\]#siU

Replacement String: [quote="\1"]\3[/quote]

This fudges the matching a bit but it should yield the correct result. You might find that you need to Save Changes on this replacement multiple times. It will keep matching additional levels of nested quotes each time you run it. Backup first to be safe.
 
#12
I was able to get this down to 36,058 posts, but now I keep getting "The connection was reset" in my browser. I took a shot in the dark and added

Code:
ini_set('memory_limit', '-1');
 
ini_set('max_execution_time', 0);
to my config.php but it has not helped at all. Any ideas?
 
#14
Try using this to narrow it down:

Quick Find: [quote author
still scratching my head. now i can't even get my results to show up. a few seconds after clicking "Proceed" i get this:



if i switch the Quick Find back to [quote then i get "Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 51 bytes) in C:\xampp\htdocs\ocommunity\library\Zend\Db\Statement\Mysqli.php on line 304"

I changed my php.ini so that the memory_limit is 512M and the max_execution time is 180.

Any idea what is going on?
 

Jake Bunce

XenForo moderator
Staff member
#15
Check your phpinfo to make sure the new memory_limit is working:

admin.php?tools/phpinfo

There are also other ways to increase the memory_limit. See this post.

You might also have to edit the library/XenForo/Application.php file (regarding this thread):

Code:
		@ini_set('memory_limit', 128 * 1024 * 1024);
 
#17
OK, i set the memory_limit to -1 and it took effect, and I also edited the Application.php so it said

Code:
@ini_set('memory_limit', 1024 * 1024 * 1024);
and it still gives me the "Connection was reset" after a few seconds. Should I lose hope?
 
#20
That's a javascript timeout. You apparently resolved the previous limit and exposed a new one. Read from this post to the end:

http://xenforo.com/community/threads/one-styles-code-is-merging-with-another.19468/#post-250365

In short, edit this file:

js/xenforo/xenforo.js

Search for "3E4". Increase the value. 3E4 is 30000 ms (or 30 seconds).
not sure what you mean. when i search for "3E4" in xenforo.js, i get this:

Code:
(null,c.parseJSON(a.responseText),b)}catch(e){XenForo.handleServerError(a,b,d)}},headers:{"X-Ajax-Referer":h.URL},timeout:3E4},e);if(!e.data._xfResponseType)switch(e.dataType){case
how do i know what 3E4 should be replaced with? my math is terrible.

also, any idea why my board went to crap? how did it get so screwed up that i can't even post anymore?

BTW, you should keep a big PayPal link in your signature. :notworthy: ;)