Importing / migrating SMF2 to Discourse - The Ultimate Guide

impressive! even if my old SMF isn’t using pretty URLs?

what do you mean by not really?

To your questions:

  1. Yes, but…
  2. Not really means that the links to the topic ID (e.g. index.php?topic=123) will be created as permalinks and will work, but anchors to specific posts such as index.php?topic=123.msg789#msg789 will not be preserved/work anymore. They are truncated to the topic ID.

Here below an example of permalinks from my forum, imported from SMF2

image

2 Likes

at least the topic will still be a reference for specific posts. that is plenty good enough. excellent, thanks so much for your reply and also for putting together these instructions.

1 Like

sorry, forgot to ask - if my SMF is setup as category->board->child board, must i first remove the category “board” so it’s only two layers deep (forum->subforum) to convert properly to Discourse?

Hi @marcozambi,

I’m curious about how you got this working. I’ve used the importer on October-19 to get a large forum from SMF to Discourse and all the links in the old format are basically lost (meaning I get a 404 when using the old urls).

For instance, the old link:
https://www.forumscp.com/index.php?topic=53080.0

identified the following topic:

Would you mind sharing your “magic”? :grin:

No special magic.
When I did the import from SMF in september 2018, the SMF2 importer script did all the magic.
After importing each post, the script was creating the related permalink.
I did anyhow do minor customisations to the scripts that I detailed in the first post of this Topic.

1 Like

That’s correct. You need to “flatten” your existing SMF sub-forum tree to 2 layers.

1 Like

Yes, and I thank you for your great post, I’ve followed it thoroughly and was able to successfully migrate a 6 million post forum.

But maybe the permalinks were created after all, how do you check for them? If they’re in the database then it might be just a nginx problem that I need to fix.

You can check the list of your Permalinks by going to Admin → Customize → Permalinks.
From there you can also create new ones, if needed.

1 Like

:+1:

It was empty, as I suspected. It means that part of the script didn’t work in our case. :expressionless: Oh well, I can still build up some of them manually (just tried and succeeded for the example I posted above).

Is this step supposed to be the old smf2 database details, or should it be exactly ‘user’, ‘pass’, ‘db’?

Is this step supposed to be the old smf2 database details, or exactly as specified; ‘db’, ‘user’, and ‘pass’?

Is this the only step I’m supposed to use the original old smf2 database details?

These are the credentials to connect to the dockerised Mysql instance where your smf forum’s database dump was imported.
To be clear, the dockerised mysql is running on the same server where Discourse runs, and it’s only needed to contain the dump you should have done of the smf database.

This is the command you shall execute on the server hosting the smf2 original database in order to obtain a dump, that you will then have to import in the dockerised MySql instance mentioned above.

1 Like

Thank you for replying.

Yes, I already imported the original smf2 database to the Discourse server in the dockerized mysql instance.

With the dockerized mysql info in Settings.php, I get this error upon running the import script:

Loading existing groups…

Loading existing users…

Loading existing categories…

Loading existing posts…

Loading existing topics…

creating groups

Traceback (most recent call last):

11: from script/import_scripts/smf2.rb:701:in `’

10: from script/import_scripts/smf2.rb:28:in `run’

9: from /var/www/discourse/script/import_scripts/base.rb:47:in `perform’

8: from script/import_scripts/smf2.rb:66:in `execute’

7: from script/import_scripts/smf2.rb:77:in `import_groups’

6: from script/import_scripts/smf2.rb:281:in `query’

5: from script/import_scripts/smf2.rb:287:in `__query’

4: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rack-mini-profiler-2.0.4/lib/patches/db/mysql2.rb:22:in `query’

3: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/mysql2-0.5.3/lib/mysql2/client.rb:130:in `query’

2: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/mysql2-0.5.3/lib/mysql2/client.rb:130:in `handle_interrupt’

1: from /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/mysql2-0.5.3/lib/mysql2/client.rb:131:in `block in query’

/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/mysql2-0.5.3/lib/mysql2/client.rb:131:in `_query’: Table ‘db.smf_membergroups’ doesn’t exist ( Mysql2::Error )

Any ideas?

I’ve followed this guide line by line to a “T” several times but keep getting stuck at this point.

Thanks.

Check in your mysql database if the smf_membergroups table exists. If not, either

  1. You’ll need to modify the script to account for a different table name or,
  2. Skip importing groups if none exist
2 Likes

The file extension in the end doesn’t matter. If the file contains valid SQL statements, it will be loaded regardless.

1 Like

Also, it’s common that the database might have a different prefix than smf_. Many importers have that as an option, but I haven’t checked this one.

2 Likes

Using same credentials from smf2 database for dockerized mysql instance resolved my issue. Thanks guys!

Screen Shot 2020-08-27 at 2.13.41 PM

1 Like

@Paracelsus I seem to be in the same boat; permalinks empty. :frowning:

My smf2 runs on the root domain while Discourse runs on a subdomain of smf2’s root domain. Does that matter?

Yeah… the permalinks are a bitch, but I learned to live with it. I googled every webpage I could find where a link to our forum was posted (with the old SMF format), went to those webpages, picked up some text string or transcribed paragraph, searched for it in the discourse forum and put a permalink in place. If you still have your SMF forum up, I would recommend you to do it now, since sometimes these links people put on their webpages don’t have any associated quote/text string, just the url, and you can still find the right topic.

For us, we used our first version as discourse.forumscp.com having forumscp.com in SMF as the “production forum” for a while (to be able to test things in discourse and get used to it). I tested the process of incremental updates a few times now and then a couple of weeks before to make sure the transition would work as it should, and on the transition day we took down our old forum, made the last incremental database update from SMF to discourse and then changed the domain following the instructions they have somewhere around here. We also needed help from our host to check the nginx configs and I can’t remember exactly but there was something with the DNS that we had to change, but we simply followed our hosts instructions and everything went fine.

You can look for another importer that does permalinks and copy the code. vbulletin and phpbb are probably good examples.