Simple Machines Community Forum

SMF Support => Converting to SMF => Topic started by: Dismal_Bliss on March 11, 2013, 03:08:57 PM

Title: Converting from Phorum 5.2 to SMF
Post by: Dismal_Bliss on March 11, 2013, 03:08:57 PM
Hello,

I am trying to use the converter found here at Simple Machines to convert my Phorum installation over to SMF for testing. But during the conversion I get the following error...

QuoteConverting members... Successful.
Converting categories... Successful.
Converting boards... Successful.

Converting topics... Unsuccessful!

This query:

SELECT
m.thread AS id_topic, m.forum_id AS id_board, m.message_id AS id_first_msg,
m.user_id AS id_member_started, (m.thread_count - 1) AS num_replies,
m.viewcount AS num_views, IF(m.sort = 1, 1, 0) AS is_sticky,
MAX(m2.message_id) AS id_last_msg, m.closed AS locked
FROM `rlangle_phorum`.phorum_messages AS m
INNER JOIN `rlangle_phorum`.phorum_messages AS m2 ON (m2.thread = m.thread)
WHERE m.message_id = m.thread
AND m.parent_id = 0
GROUP BY m.thread
HAVING id_first_msg != 0
AND id_last_msg != 0
LIMIT 0, 500;

Caused the error:

BIGINT UNSIGNED value is out of range in '(`rlangle_phorum`.`m`.`thread_count` - 1)'


Can someone help me get beyond this situation?
Title: Re: Converting from Phorum 5.2 to SMF
Post by: nbenn on March 18, 2013, 08:19:18 AM
Dear SMF Forum

I too just attempted to convert a Phorum 5.2 database to SMF 2. I got past the topics section which failed for Dismal_Bliss. Unfortunately the script errors in the pm section. It seems the database layout in this section received a few modifications. I got past a few errors in the step 1 section by modifying the script to accept some new column names. Unfortunately step 2 requires some more involved modifications: the pm recipients are now saved in a column called meta. The following example should provide an idea of how meta is formatted

a:1:{s:10:"recipients";a:1:{i:18;a:3:{s:7:"user_id";i:18;s:12:"display_name";s:8:"Sarah G.";s:9:"read_flag";s:1:"1";}}}


Unfortunately my MySQL skills do not suffice to change the conversion script. Is there anyone willing to help out? I also posted a conversion script request under

http://custom.simplemachines.org/converter_request.php?id=168
Title: Re: Converting from Phorum 5.2 to SMF
Post by: nbenn on March 18, 2013, 08:57:58 AM
I messed around with the sql code and the conversion (Phorum 5.2.19 to SMF 2.0.4) now works for me. The original code in phorum_to_smf.sql line 124:


/******************************************************************************/
--- Converting personal messages (step 1)...
/******************************************************************************/

TRUNCATE {$to_prefix}personal_messages;

---* {$to_prefix}personal_messages
SELECT
p.private_message_id AS id_pm, p.from_user_id AS id_member_from,
p.datestamp AS msgtime,
SUBSTRING(IFNULL(u.username, p.from_username), 1, 255) AS from_name,
SUBSTRING(p.subject, 1, 255) AS subject,
SUBSTRING(p.message, 1, 255) AS body, p.from_del_flag AS deleted_by_sender
FROM {$from_prefix}private_messages AS p
LEFT JOIN {$from_prefix}users AS u ON (u.user_id = p.from_user_id);
---*

/******************************************************************************/
--- Converting personal messages (step 2)...
/******************************************************************************/

TRUNCATE {$to_prefix}pm_recipients;

---* {$to_prefix}pm_recipients
SELECT
private_message_id AS id_pm, to_user_id AS id_member, read_flag AS is_read,
to_del_flag AS deleted, '-1' AS labels
FROM {$from_prefix}private_messages;
---*


My modifications:

/******************************************************************************/
--- Converting personal messages (step 1)...
/******************************************************************************/

TRUNCATE {$to_prefix}personal_messages;

---* {$to_prefix}personal_messages
SELECT
p.pm_message_id AS id_pm, p.user_id AS id_member_from,
p.datestamp AS msgtime,
SUBSTRING(IFNULL(u.username, p.author), 1, 255) AS from_name,
SUBSTRING(p.subject, 1, 255) AS subject,
SUBSTRING(p.message, 1, 255) AS body
FROM {$from_prefix}pm_messages AS p
LEFT JOIN {$from_prefix}users AS u ON (u.user_id = p.user_id);
---*

/******************************************************************************/
--- Converting personal messages (step 2)...
/******************************************************************************/

TRUNCATE {$to_prefix}pm_recipients;

---* {$to_prefix}pm_recipients
SELECT
pm_message_id AS id_pm, SUBSTRING(meta,LOCATE('user_id',meta)+11,
LOCATE('display_name',meta)-LOCATE('user_id',meta)-18) AS id_member,
SUBSTRING(meta,LOCATE('read_flag',meta)+13,1) AS is_read,
'-1' AS labels
FROM {$from_prefix}pm_messages;
---*


I hope this helps.
Title: Re: Converting from Phorum 5.2 to SMF
Post by: Dismal_Bliss on March 18, 2013, 02:42:04 PM
Interesting. I am running 5.2.18 so I will upgrade to 5.2.19 and see if I can progress further like you did, and then make the modifications that you have mentioned above.

I've also tried converting to phpBB3 but I lose all my attachments, which are stored using Mod: Store files on disk.

Title: Re: Converting from Phorum 5.2 to SMF
Post by: Dismal_Bliss on March 18, 2013, 09:40:45 PM
I read over on the phpBB3 forums that a person had success when he altered "Store Files on Disk" to save the files in a single directory. So I have copied all files to a single directory, and will be trying it again soon.
Title: Re: Converting from Phorum 5.2 to SMF
Post by: neonkaos on October 29, 2013, 05:49:37 PM
Hi, I am converting from Phorum 5.2.19 to SMF 2.0.6.  I searched this site and this thread is the closest thing that came up, but I don't see the solution to my problem here.  I did try replacing the code in the phorum_to_smf.sql file but it didn't solve it.

When I run the converter, it says:

Converting members... Successful.
Converting categories... Successful.
Converting boards... Successful.
Converting topics...Wrong value type sent to the database. Integer expected. (num_replies)

Then it stops.
That is all.  How to proceed?
Title: Re: Converting from Phorum 5.2 to SMF
Post by: Oldiesmann on October 30, 2013, 11:24:52 AM
What value is in the "thread_count" column in Phorum's messages table? That's the value SMF uses to calculate "num_replies", so I'm not sure why you'd be getting that error unless your database is messed up.
Title: Re: Converting from Phorum 5.2 to SMF
Post by: neonkaos on October 30, 2013, 02:34:16 PM
Quote from: Oldiesmann on October 30, 2013, 11:24:52 AM
What value is in the "thread_count" column in Phorum's messages table? That's the value SMF uses to calculate "num_replies", so I'm not sure why you'd be getting that error unless your database is messed up.

It says int(10).  I attached a screenshot.  The database repair thing said "OK" to everything.  I tried running the converter again and it did the same thing.
Title: Re: Converting from Phorum 5.2 to SMF
Post by: Oldiesmann on November 01, 2013, 12:05:31 PM
Well, the only thing I can think of is that the thread_count is 0 somewhere, which would result in SMF calculating the "num_replies" as -1.

Try running this query in phpMyAdmin on your phorum database and see if this fixes the problem:

UPDATE phorum_messages SET thread_count = 1 WHERE thread_count = 0;
Title: Re: Converting from Phorum 5.2 to SMF
Post by: mentalist on November 02, 2013, 08:42:45 AM
Quote from: Oldiesmann on November 01, 2013, 12:05:31 PM
Try running this query in phpMyAdmin on your phorum database and see if this fixes the problem:
UPDATE phorum_messages SET thread_count = 1 WHERE thread_count = 0;

huh, never ever touch the old forum's database ;)
You can also modify the converter, in phorum_to_smf.sql find
---* {$to_prefix}topics
add after:
---{
$row['num_replies'] = (int) $row['num_replies'];
--- }

Title: Re: Converting from Phorum 5.2 to SMF
Post by: Oldiesmann on November 02, 2013, 12:21:27 PM
That will work as well, but the fact that it's not an integer all the time indicates there's a problem with the Phorum database.