I just converted my old XMB 1.9 forum over to SMF, and the only problem I have is that all of the apostrophes and quotes in the posts/threads on the converted SMF install are now escaped with backslashes.
*HOW* do I get rid of those?
-Misanthrope
Have you had any new posts yet?
Is it both " and '? I assume \ also would be escaped - anything else? Are most bbc tags working properly?
I'm afraid the XMB converter hasn't had as much testing as we'd like, but I wasn't aware of this issue. I wonder if it's only 1.9, but I expect it's probably not.
-[Unknown]
Yes, apostrophes and quotes were escaped.
The way XMB works, it stripslashes everything it pulls from the database before displaying it, and when I look inside the XMB database I see backslashes all over the place. So XMB aparently adds slashes somewhere in the process of putting information into the database, and I think that's what's confusing your converter's output.
So the converter should strip the slashes out of the data pulled from the XMB database before sticking it in the SMF database. I think this would fix the conversion problem. I'd do it, but my PHP mastery isn't quite up to the level I'd like it to be.
-Misanthrope
Quote from: Misanthrope on December 10, 2004, 02:30:47 AM
So XMB aparently adds slashes somewhere in the process of putting information into the database
So does all properly-written software (including SMF).
<edit>At least I thought it did, but it looks like it's giving us ' and " instead now.</edit>
Without checking to see if the database input is already escaped? In a lot of places I'm seeing multiple backslashes, and this is what I\\\\\'m talking about.
-Misanthrope
Incidentally, I'm something of a total amateur with PHP/MySQL, so bear with me if I sound like an idiot...it's just that my forum is for a commercial website, and I can't really just flush all the posts and start over. I'd really like to get rid of XMB once and for all, and SMF seems to be one of the very few decent forum packages that has a converter for XMB.
-Misanthrope
I'll try to get to it this week (meaning next couple days) and attach the updated converter. The thing is, if you put this into the database:
'don\'t'
It will store the word "don't", without the slash. You add the slash to make sure it knows not to end the ' you started. What XMB is apparently doing is this:
'don\\\'t'
Which is adding the extra slash in the actual data *stored*. This is, imho, strange behavior... but whatever.
As for SMF, to avoid some complication caused by using preg_replace with the e flag (glow, shadow, etc.), slashes are avoided in the message body.
Incidentally... while I'm looking at it... were there any other problems at all you encountered? Edit: Nevermind, it was simpler to fix than I thought it might be, after double checking an XMB install.
-[Unknown]
Wow, that was fast...
Yeah, I expected the conversion to go better than it did because of what you described, that "don\'t" goes into the database as "don't". That's how I thought it would work, and that's why I figured the problem was caused by XMB rather than being a general PHP/MySQL issue.
I'm gonna give the new converter a try and let you know how it worked out.
-Misanthrope
In fact, my forum did this to me too.
I just always delete them, when i go and change my permissions.
but did find this problem a little werid... :|
I just did a conversion using the new converter, from XMB v1.9 Nexus (alpha 7), and the only backslashes left were in the forum and post titles.
On another note all the U2U messages were lost. Not the end of the world, but it would be nice to be able to convert them as well.
So everything is backslashed like that. I see.
-[Unknown]
! XMB converter was adding slashes in bad/annoying places. (xmb_to_smf.php)
-[Unknown]
So unknown have the errors been fixed?.. or?
Thats what he means I guess :P
Legend:
--------------------------------------------------------------------------------
! Minor change or bugfix. (don't bother to log typos except between releases.)
* Change like above, but affects templates.
& Change that affects a language file. (make two if it affects templates too.)
+ Feature addition or improvement.
- Feature or option removal.
% Development flag or note, such as branching.
-[Unknown]
Ok, the converter does import the u2u messages into the database, but they are not viewable.
Sending new ones work fine, but none of the converted ones can be seen.
Apparently they are not being placed into the smf_im_recipients table.
Any ideas on how to add this to the converter, or running a sql query to import them into it??
Is the im_recipients table totally empty? You can check with phpMyAdmin... What is phpMyAdmin? (http://www.simplemachines.org/community/index.php?topic=21919.0)
-[Unknown]
Quote from: [Unknown] on December 20, 2004, 05:42:19 PM
Is the im_recipients table totally empty? You can check with phpMyAdmin... What is phpMyAdmin? (http://www.simplemachines.org/community/index.php?topic=21919.0)
Yes, except for the couple of new test IMs it is totally empty.
That's how I figured out that was the problem.
Any luck on finding a fix for this script yet?
Can you tell me if this helps at all? Any error messages at all?
-[Unknown]
I received no errors on the other versions but got a couple with this one...
Converting personal messages... successful.
Converting personal messages (step 2)...Unknown column 'pm.new' in 'field list'Column count doesn't match value count at row 1 successful.
and
Converting attachments...
Error: Could not copy Midwest_Skydiving_Challenge.pdf
successful.
And still nothing is populating the smf_im_recipients table.
All of the u2u meessages appear to have been imported into the smf_instant_messages table though.
There's also a slight problem with the "Last post" column data on the start page, but that will be quickly resolved with new posts.
Thanks for working on this...
Try this one.
-[Unknown]
Sweet...
That looks like it got the job done. All u2u's are there and viewable.
The last post data is still inaccurate, but that's a non-issue for my use.
I'll go through the rest of the forums later and see if anything is missing or wrong.
Thanks for the help.
Quote from: Onsite on December 22, 2004, 07:28:19 AM
The last post data is still inaccurate, but that's a non-issue for my use.
Darn, I tried to fix that one too. How innacurate is it? Are the posts it names at least in the right board?
-[Unknown]
It's actually way off...
It lists users who never even posted in those forums and dates from two years ago.
For example, SlipStream isn't even allowed to post in this forum and the last post was 4 days ago.
January 31, 2003, 10:25:52 pm
in N/A
by SlipStream
Can you try changing this:
// Make the last topic correct.
$result = mysql_query("
SELECT fid
FROM {$from_prefix}forums");
while ($row = mysql_fetch_assoc($result))
{
$result2 = mysql_query("
SELECT tid
FROM {$from_prefix}threads
WHERE fid = $row[fid]
ORDER BY tid DESC
LIMIT 1");
list ($newTopic) = mysql_fetch_row($result2);
mysql_free_result($result2);
mysql_query("
UPDATE {$to_prefix}boards
SET ID_LAST_MSG = $newTopic
WHERE ID_BOARD = $row[fid]
LIMIT 1");
}
mysql_free_result($result);
To:
// Make the last topic correct.
$result = mysql_query("
SELECT fid, MAX(tid) AS tid
FROM {$from_prefix}threads
GROUP BY fid");echo mysql_error();
while ($row = mysql_fetch_assoc($result))
{
mysql_query("
UPDATE {$to_prefix}boards
SET ID_LAST_MSG = $row[tid]
WHERE ID_BOARD = $row[fid]
LIMIT 1");echo mysql_error();
}
mysql_free_result($result);
Any difference?
-[Unknown]
Nope, no difference...
Grrr.... I wish I had a big enough database to test this with.
I'll stop bothering you, since it's not a huge deal. I'll have to look at it a bit later.
Thanks again,
-[Unknown]
Hey no bother...
I'll keep my XMB database after I go live with SMF, so if you want to test the converter some more I'll be happy to run it for ya.
Can you try the attached?
-[Unknown]
That worked...
The Last Post column is accurate now.
I did find another bug, if you still want to work them out.
The BB code [align=center][/align] doesn't convert to
! The XMB converter now properly parses the [align] bbc tag. (xmb_to_smf.php)
(hopefully...)
Anything else?
-[Unknown]
Just ran the new converter and got this error:
Converting polls...
Notice: Undefined offset: 1 in /usr/home/www/htdocs/forum_smf/xmb_to_smf.php on line 853
And the last post column is wrong again.
I'll run the previous converter to see if it works later.
Thanks
Okay, how about this one?
-[Unknown]
Well no errors this time, and the latest posts column is correct, but I checked on some of the old polls and none of the votes or totals converted over.
Alrighty....
Here are some more noticed glitches.
- Only about 60% of the u2u messages are converted
I just did a convert and 560 out of 1070 where converted, I haven't figured out the pattern yet
- Any attachments with odd characters like spaces or slashes in the filename are lost
I went into XMB and renamed them and it worked 100%
- Forum titles, and signatures still have backslashes
I posted a request to have the users edit their profiles
Other than the lose of u2u messages it's easy to work around the other problems.
I only have one other account to switch over, so if an updated converter pops up soon I'll wait to see how it works and report back.
Hmm... u2u... strange. Is it possible these were in the outbox at all?
Please try the attached.
-[Unknown]
Quote from: [Unknown] on January 27, 2005, 09:50:55 PM
Hmm... u2u... strange. Is it possible these were in the outbox at all?
Yeah I'm not real sure what the issue is.
I see how SMF stores the messages in mysql and that XMB tags an separate id on both incoming and outgoing, but I can't seem to figure out which ones are not converting.
I went into XMB's database and deleted all the messages that where in the outbox, which seems to have fixed the problem.