Importing from phpBB

Hello, I’m trying to import an old phpBB2 forum into the new Discourse.

I made the preliminar import from phpBB2 to phpBB3, as stated in your docs.

I had problems with avatar import (no import), and with passwords. Surely Discourse use a different cryptation method than phpBB2, so I was thinking to write some code that at the first login would check if passwords are crypted in the phpBB2 way, check if with phpBB2 cryptation (md5?) password match the saved hash and then rewrite it with Discourse cryptation.

Usually, with the “old good guys” PHP and mySql, it’s just an half an hour job, but with Discourse I don’t even know where to start modifying the source. My old phpBB2 was heavily modified (for such a reason I never updated it to phpBB3), but I know that this is not a good habit and I don’t want to mess Discourse and loose his update automatism, so I’m asking how could I manage my need. Shall I develop a plugin? Any chance to have this feature in a new “beta” version?

Thanks

To import passwords you need the Migrated password hashes support plugin. This might solve your passsword problem.

It’s hard to say whether your avatar problem is because your data is not compatible or if you just didn’t configure the script correctly.

1 Like

Thank for your hint, I’ll try it asap. Regarding avatars, I double checked every step as from your guide, but with no success. However, as I’ll have to repeat the import, I’ll try to watch every step and report to you.

1 Like

I’m not the owner of this topic but I like to connect as I’m on same journey basically.

Currently I’m playing with the import_phpbb3 and there I’m facing some challenges already while creating the users. I like to migrate user avatar as well, but it seems it is not working for all users. For some I’m getting following issue

Failed to upload avatar for user myuser: /shared/import/data/images/avatars/upload/phpbb_avatar_2.png
#<ActiveModel::Errors:0x00000055a4b3de78 @base=#<Upload id: nil, user_id: nil, original_filename: "avatar.png", filesize: 0, width: nil, height: nil, url: nil, created_at: nil, updated_at: nil, sha1: nil, origin: nil, retain_hours: nil, extension: nil, thumbnail_width: nil, thumbnail_height: nil, etag: nil, secure: false, access_control_post_id: nil, original_sha1: nil, animated: nil, verification_status: 1, security_last_changed_at: nil, security_last_changed_reason: nil>, @errors=[#<ActiveModel::Error attribute=base, type=Sorry, the image you are trying to upload is too large (maximum dimension is 80-megapixels), please resize it and try again., options={}>]>

Problem seems to the png file format. Is there a way to import png files as well or do they need to be gif/jpg? oxipng is already installed.

root@DietPi4-import:/var/www/discourse# which oxipng
/usr/local/bin/oxipng
root@DietPi4-import:/var/www/discourse#

Regarding the password plugin. It have it activated as port of building the import container. Or does it need to be done as well on the discourse container? Is there a way to see if this has been working or would it be something user need to try out?

Many thanks in advance.

The migrate password plugin is meant to be activated only on the forum after the migration has been done, otherwise, it can cause errors during the user imports.

To see if it’s working, just activate it and try to log in with your old password.

3 Likes

thx for feedback @Canapin
In this case I will rebuild production container before restarting it, after import finished on import container.

BTW: can someone from the admin team check my initial post. It seems I adjusted it to much and got marked as SPAM :smiley:

Nobody has an idea why import of PNG files is not working?

More information would be useful. Which version of phpBB? Any error message?
Can you elaborate “not working”?

1 Like

Already shared above. It seems the import script is not able to read PNG files correctly as basically all values are nil

Oh sorry, I didn’t see you already posted the issue. Can’t help you with that sorry, I don’t have the proper skills.

edit : (maybe to prevent my little “mistake”, you could have replied to your own message so I could have seen your first message)

I’m seeing this from time to time during migrations and the affected files usually can’t be opened in a image viewer because of a unknown file format. I’m always assuming those files got corrupted over the years.

Are you certain that the PNGs you are trying to import are valid image files? If so, can you share an example. Also, are you importing within the Docker container or in a dev environment?

3 Likes

TL;TR; Pictures got corrupted while transferring them to Linux box.

@gerhard I was 100% sure my PNG files are valid and correct, as I was able to open them on my Windows computer. However your hint pushed me into right direction and I verified the PNG files how they looks like on the Linux box. And you where absolutely right, as all PNG files got damaged. Root cause was the way how I transferred them. I used SCP (WinSCP) and PNG files got transferred as text files, leading to the corruption. On my new attempt I transferred everything as 7z archive and just extract them directly on the Linux box. This time the import was working fine.

Much appreciate your support, pointing me into right direction :+1:

While my import is working now for 99,9% of all post, I have one more question. Is there a way to transfer the status for solved topics as well? On the new prod forum I plan to use discourse-solved. Question how to transfer the old status into new world?

Again: Much appreciate your support.

2 Likes

I’m not aware of a solved status in phpBB. Is this a extension/mod? I guess you will need to customize the import script in order to import it.

I had a look to into phpbb database and now I know the field that stores information about a topic/post being solved. Just need to find out how and where to store it in Discourse database. :roll_eyes:

1 Like

You can look at other import scripts that support that (search for “solved” I think) You’ll need to have the plugin installed in your import instance.

1 Like

Thx for your answer, but that seems to go beyond my skills.

On the source phpbb database, the post ID solving a topic is stored on

  • phpbb_topics.topic_solved.

In Discourse, the information is stored on 3 different fields (if I’m not mistaken)

  • post_custom_fields.is_accepted_answer
  • topic_custom_fields.accepted_answer_post_id
  • topic_custom_fields.solved_auto_close_topic_timer_id

As far as I understood, there is some kind of mapping done during the import as ID’s for topic + post are going to change.

But there my knowledge ends.

1 Like

Then explaining how to modify and debug it is likely beyond what can be accomplished here. If you have a budget you can post in marketplace or contact me.

It’s stored in a custom field called “import_id” and there are functions you can use to do lookups that you can see in the code. Something like topic_id_from_import_id()

2 Likes

Thx for the offer. We are a very small open source project without real budget. At the beginning I was not aware that the “topic solved” feature is a non-standard extension on phpbb (joined the forum years after it has been created) and thought it might be easy to fix. But I understood it’s an individual request, taking time to look into.

Again thx to you guys who helped to make it work close to perfect.

Ah btw guys, phpbb has been migrated from a version 3.3.5. It has been working fine, even if not supported.

2 Likes

If you were able to figure out what tables are involved in discourse you might well be able to copy a few lines of code from another importer.

1 Like

I see. It’s mapping phpbb post/topic id’s with Discourse post/topic id’s

This one seems to be a good example to import accepted answers discourse/script/import_scripts/lithium.rb at 44f7a61c2c5b6f248a62ab7f987ebbd3091c71ef · discourse/discourse · GitHub

But If I understood correctly, as a first step I would need to store/import the phpbb_topics.topic_solved value into postgres. right?

1 Like