News:

Wondering if this will always be free?  See why free is better.

Main Menu

Converting from My Little Forum to SMF

Started by Wombat78, September 02, 2020, 08:36:26 AM

Previous topic - Next topic

Wombat78

I have been using My Little Forum since 2004 for two forum installations. Now I have migrated users, categories and forum posts and combined them into one SMF 2.0.17 forum. As far as I know there is no converter for MLF to SMF, so I did everything manually in phpMyAdmin and Cpanel. I'm a complete amateur, but here is basically how I did it.

1. I did a clean install of SMF 2.0.17 and made sure it worked.
2. Then truncated (deleted all content) from smf_members, smf_messages, smf_topics, smf_boards and smf_categories
3. In phpMyAdmin I selected the data I needed to migrate from three tables: mlf2_categories, mlf2_entries and mlf2_userdata and created queries that could be inserteted into corresponding tables in SMF I used the following queries that matched:

User data


SELECT DISTINCT
user_id AS id_member,
user_name AS member_name,
       (SELECT COUNT(*) FROM mlf2_entries WHERE user_id = mlf2_userdata.user_id) AS posts,
gender AS gender,
birthday AS birthdate,
user_pw AS passwd,
user_email AS email_address,
email_contact AS hide_email,
user_hp AS website_url,
user_location AS location,
signature AS signature,
profile AS personal_text,
UNIX_TIMESTAMP(last_login) AS last_login,
user_name AS real_name,
user_ip AS member_ip,
UNIX_TIMESTAMP(registered) AS date_registered,
time_difference AS time_offset
FROM mlf2_userdata


I exported the query result and replaced mlf2_userdata with smf_members in the exported SQL insert query like this.

INSERT INTO `smf_members` (`id_member`, `member_name`, `posts`, `gender`, `birthdate`, `passwd`, `email_address`, `hide_email`, `website_url`, `location`, `signature`, `personal_text`, `last_login`, `real_name`, `member_ip`, `date_registered`, `time_offset`) VALUES
(1, 'USER 1', 1790, 1, '1978-05-06', 'c566182a01260e9d49cc0965ea0fdae0', '[email protected]', 1, 'https://www..homepage.url', 'Canada', 'Forum admin', 'I run this place.', 1599047907, 'USER 1', '23.45.5.343.12', 1080659701, 0),
(3, 'USER 2', 73, 0, '0000-00-00', '83acb09f2d30a75e7150b06ba97597c8', '[email protected]', 0, '', 'Where the streets have no name.', '', '', 1530560230, 'USER 2', '80.213.225.171', 1076624163, 0);


In phpMyAdmin I set id_group = 1 for the administrators.


Categories:

SELECT
id AS id_board,
order_id AS board_order,
category AS name,
description AS description
FROM mlf2_categories


Since MLF doesn't support both boards and categories I inserted the data into smf_boards. You then have to create categories manually to group the imported boards.

Topics:

SELECT
tid AS id_topic,
sticky AS is_sticky,
category AS id_board,
MIN(tid) AS id_first_msg,
MAX(pid) AS id_last_msg,
user_id AS id_member_started,
    COUNT(pid) -1 AS num_replies,
views AS num_views,
locked AS locked
FROM mlf2_entries
GROUP BY tid


In the result export I replaced mlf2_entries with smfts_topics and "INSERT" with "INSERT IGNORE".

Posts:


SELECT
id AS id_msg,
tid AS id_topic,
category AS id_board,
user_id AS id_member,
id AS id_msg_modified,
SUBSTRING(name, 1, 255) AS poster_name,
UNIX_TIMESTAMP(time) AS poster_time,
SUBSTRING(ip, 1, 255)
AS poster_ip,
subject AS subject,
SUBSTRING(email, 1, 255) AS poster_email,
SUBSTRING(edited_by, 1, 255) AS modified_name,
UNIX_TIMESTAMP(edited) AS modified_time,
text AS body
FROM mlf2_entries


Data is inserted into smf_messages.

Then recount the totals and post statistics from SMF Administration > Maintenance > Recount all forum totals and statistics and the forum is up to speed. There are of course many minor tweaks you need to do, but the data is all there.

Since MLF uses the LINK tag instead of URL it can be a good idea to replace all occurrences such as this:


UPDATE smfts_messages SET body = REPLACE (body, '[link]','[url]');
UPDATE smfts_messages SET body = REPLACE (body, '[link=','[url=');
UPDATE smfts_messages SET body = REPLACE (body, '[/link]','[/url]');


Images:

In MLF the images are stored in the folder uploads/images and the path looks like this [/img]. I uploaded the image folder to the root of the SMF install and replaced all the IMG-tags with the following query:

UPDATE smf_messages SET body = REPLACE (body, '[img]images/uploaded/','[img]https://path-to-simple-machines-forum-com/images/uploaded/');

The images then appears in the messages.

Merging:
I then repeated the above process for my other forum and merged the two SMF installations using the available merge tool (sorry, not allowed to post links since this is my first post).

I hope this can help others who are planning to convert from MLF to SMF.  :)

Dzonny

Thanks for sharing the info! :)
Everything works fine now on your end, right?

Someone might make a converter out of this instructions.

Wombat78

Yes, everything works fine. There are a couple of issues connected to login and foreign characters, but that's not connected to the import I think. Also note that I didn't bother to transfer the avatars.

There were some BB code formatting errors in the Images section above. Corrected version:

Images:

In MLF the images are stored in the folder uploads/images and the path looks like this:

[img]images/uploaded/202003010843445e5b75c0bebee.jpg[/img]

Since SMF doesn't seem to support relative paths between the IMG tags, I uploaded the image folder to the root of the SMF install and changed all the image links with the following query:

UPDATE smf_messages SET body = REPLACE (body, '[img]images/uploaded/','[img]https://path-to-simple-machines-forum-com/images/uploaded/');

Advertisement: