Migrate a phpBB3 forum to Discourse

Hi @gerhard

Thanks a lot for the importer script! I’m currently importing phpbb 3.0.9 and I have following error:

Traceback (most recent call last):
        21: from script/import_scripts/phpbb3.rb:11:in `<main>'
        20: from script/import_scripts/phpbb3.rb:12:in `<module:ImportScripts>'
        19: from script/import_scripts/phpbb3.rb:31:in `<module:PhpBB3>'
        18: from /var/www/discourse/script/import_scripts/phpbb3/importer.rb:20:in `perform'
        17: from /var/www/discourse/script/import_scripts/base.rb:47:in `perform'
        16: from /var/www/discourse/script/import_scripts/phpbb3/importer.rb:31:in `execute'
        15: from /var/www/discourse/script/import_scripts/phpbb3/importer.rb:112:in `import_posts'
        14: from /var/www/discourse/script/import_scripts/phpbb3/importer.rb:168:in `batches'
        13: from /var/www/discourse/script/import_scripts/base.rb:883:in `batches'
        12: from /var/www/discourse/script/import_scripts/base.rb:883:in `loop'
        11: from /var/www/discourse/script/import_scripts/base.rb:884:in `block in batches'
        10: from /var/www/discourse/script/import_scripts/phpbb3/importer.rb:118:in `block in import_posts'
         9: from /var/www/discourse/script/import_scripts/base.rb:501:in `create_posts'
         8: from /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/rack-mini-profiler-1.0.1/lib/patches/db/mysql2.rb:8:in `each'
         7: from /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/rack-mini-profiler-1.0.1/lib/patches/db/mysql2.rb:8:in `each'
         6: from /var/www/discourse/script/import_scripts/base.rb:502:in `block in create_posts'
         5: from /var/www/discourse/script/import_scripts/phpbb3/importer.rb:119:in `block (2 levels) in import_posts'
         4: from /var/www/discourse/script/import_scripts/phpbb3/importers/post_importer.rb:38:in `map_post'
         3: from /var/www/discourse/script/import_scripts/phpbb3/importers/post_importer.rb:64:in `map_first_post'
         2: from /var/www/discourse/script/import_scripts/phpbb3/importers/post_importer.rb:89:in `add_poll'
         1: from /var/www/discourse/script/import_scripts/phpbb3/importers/poll_importer.rb:28:in `map_poll'
/var/www/discourse/script/import_scripts/phpbb3/importers/poll_importer.rb:103:in `add_poll_to_custom_fields': uninitialized constant DiscoursePoll::POLLS_CUSTOM_FIELD (NameError)
Did you mean?  PostCustomField

Do you have any idea why those are not initialised. It seems like there ate not such tables on a discourse DB.

Thank you!

PS. I managed to import everything but polls.

1 Like

Importing of polls is currently broken and I didn’t get around to fixing it yet.

You could run the import with the stable branch of Discourse. Or an earlier beta – I think up to beta4 or 5 should work. You can upgrade after the import. I’m sorry for the inconvenience.

3 Likes

@gerhard that will do :wink:

So Discourse changed its database structure right?

1 Like

settings.yml says it will add permalinks for /viewtopic.php?f=6&t=43 URLs, but it won’t actually do so, it will only make permalinks for /viewtopic.php?t=43 URLs.

I took a look at the code, and it looks like it wouldn’t be too hard to do this. I’d need to patch to the following in post_importer.rb (adding the forum_id), and then make a second permalink.

@permalink_importer.create_for_topic(post.topic, row[:topic_id], row[:forum_id])

Does that sound about right? Would you accept a PR for this? If I work on this, is there a way to just run the permalink importer so I don’t need import my full forum from scratch?

I’ve also noticed that it doesn’t use the site prefix settings, so if you’re changing paths, like from a subdirectory to a subdomain, the permalinks will be useless. What if there was a setting for a permalink prefix to add to the front?

The import script adds permalink normalizations in order to deal with all sorts of irrelevant query parameters. Otherwise you’d need to add a lot of permalinks for all the possible variations of the query string. I don’t think there’s a case where it doesn’t work.

https://github.com/discourse/discourse/blob/a09b20f934706092bbd6fb6a2ebc96b076d33614/script/import_scripts/phpbb3/importers/permalink_importer.rb#L3-L5

I’m not 100% sure, but I think that should also work for subdirectories. If it doesn’t, feel free to create a PR.

5 Likes

Well I feel dumb, I had accidentally reset the permalink normalisations setting. Thanks!

I haven’t got subdirectories working yet. Will investigate more tomorrow.

PR for a prefix setting: https://github.com/discourse/discourse/pull/6966

Also Discourse 2.2.0 has now been released, but I assume importing polls will still be problematic? I imported with 2.1.7 and it was fine.

1 Like

Hello,

is it possible to also import the Thanks/Likes made with the phpBB extension “Thanks for Posts” into Discourse? Here’s a link to the extension: phpBB • [CDB] Thanks for posts

I just checked the thanks table in the database. It looks pretty simple for me. Post ID, poster ID, user ID, topic ID, forum ID and a timestamp. No idea why there has be a poster ID (the user which received the thank) and also topic and forum ID as I would say post, user (who gave the thank) and timestamp should be enough.

I’m asking because this extension is heavily used with over 2000 thanks in the forum I want to migrate to Discourse. Also I would say it is a very common extension used by many phpBB forum admins.

Thanks and cheers,
Roi

2 Likes

Mods are currently not supported, but you can modify the import script yourself (pull request welcome), post in #marketplace or sign up at for a plan at discourse.org and let us worry about it.

1 Like

I recommend going with discourse.org hosting if it fits your budget. I can make the modifications if you have a smaller budget. My contact info is in my profile.

2 Likes

I just finished migrating my phpBB3.2 into the discourse server.

I followed this thread of @gerhard.

In my case I had to run the following code:

cd ~/discourse/script/import_scripts
ruby phpbb3.rb phpbb3/settings.yml

from the project root:

ruby script/import_scripts/phpbb3.rb script/import_scripts/phpbb3/settings.yml

then running bundle exec rails server --binding=0.0.0.0 worked like a charm.

Now I have a fresh discourse server with posts that I actually care about which makes using discourse server a lot more meaningful to me.

Need to use my Discourse server in place of my phpBB3.2 to find out things that I want to improve. But as for now, I didn’t run into major problems while migrating. I don’t use any files or avatars, so I can’t comment on them.

Thanks for your effort!

6 Likes

Someone has pointed out to me that there’s a security leak with the full name fields and this migration script:

The public full name field in the profile is apparently automatically filled in based on the user’s email address? My email address starts with juhana.if and the full name was shown as Juhana If. This might be a problem to someone who signed up here with a pseudonym and didn’t want their real name revealed, and didn’t expect that part of their email address was to be made public. Now you can browse the user list and see a lot of real names there. Not only that, but you can probably guess many email addresses by just adding @gmail.com to the end.

This seems like quite a serious issue IMO.

I’m expecting to do the real migration for my forum this week. Any ideas on how to disable this?

Also a small thing that could be added to your todo list at the top: importing phpBB foes as muted users.

There is a site setting to not make full names visible.

2 Likes

Hmm, I’m not opposed to them in general, just these auto imported ones. But thanks, that will give us a stopgap solution. I should be able to run a query to reset them.

Edit: wait, isn’t this what the username_as_name setting is meant to handle? settings.yml says that “When false: the name of each imported user will be blank unless the username was changed during import” but that’s not true.


Is importing polls still an issue with stable/tests-passed? Anyone tried a migration recently? It’s easy enough to start with 2.1.x and then upgrade to 2.2.x if so.

I’ve raised some issues here, but I have to say that on the whole the migration has been very smooth. Thank you @gerhard and everyone else who’s worked on it!

1 Like

Yes, it looks like setting username_as_name to false was broken. I agree that setting the name from the email address may be a privacy concern, so I removed that line of code from the base import script. https://github.com/discourse/discourse/commit/8d5dfe1e01ac279f04fceda798400d9f41710c81

Yes, unfortunately it’s still not working.

5 Likes

good day everyone ! I’m the founder and admin of http://www.e-sk8.fr/forum

It’s a simple but effective forum using PHPBB with just one forum theme and no plugin. Really the basics.

I would like to explore the move to Discourse. Is there a way to trial this to see if it worth? I’ve seen some 20 euros/month hosting that could be more relevant for me (small forum) than a 100 USD / month.

Thanks a lot !!!

See https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md. Also, see https://www.literatecomputing.com/discourse-migration/ for help with the migration. You can search for “phpbb3 #howto” for more info. My site has a referral link for Digital Ocean that’s good for 60 days credit. The data center in Amsterdam is really good.

Hi Jay ! thanks a lot for the feedback. I just

  • created a digital ocean account
  • a mailgun account
  • a new disclosure droplet
  • completed the installation via ssh

I’ve got the discourse up and running but now I’m looking to migrate the PHPBB 3.2 to it. Unfortunately I’m not able to cover that much of money. All I do in my community is with my pocket money and I don’t get any money out of that. I spent all my time in helping people around me and will not able to afford “expertise” for that.

Glad you’re up and running! I told you to search for the importer,but here

Thanks Jay ! Much appreciated. I wish I could have the money for you to help me out. But I’ll do my best.

I’ve installed the script and exported the database as a full export directly within PHPBB and the script says it cannot work with phpbb 3.2.x

1 Like