Importing from phpBB3

I seem to be the only one posting here…

So, right when I am about to launch my new discourse forum, we discovered a very strange issue! I’m stumped with this issue, I’m hoping someone here can shed light on it…

Case: I have imported 2 databases into discourse from phpbb3. First one is an archive, which is basically the current forum we had cut in two 15 years ago and then frozen. The other half of the forum stayed active and grew. My hope was that the importer would merge them on import, which it did! :smiley:

But now I discovered a case of one user, and I need to know whether this is only one case, or if it has impacted others, and then how to be able to search for other cases.

The user had created two accounts. Both on the current forum. Let’s say old account was named OldName and new is NewName.

On the imported discourse, there are now two users. One called OldName and the one that should have been NewName is renamed to OldName1 Also, the posts of OldName have been merged into OldName1.

I have no clue why this only happened to this user since there are other users with double accounts and they don’t seem to be affected by this.

Does anyone know what might have happened here?
Is there a way to search for other cases?

But probably not how you think. If you merely ran the importer twice, all of the import_id custom fields conflicted, so the user with userid 123 on the first database is now the same user as userid 123 in the new database. And the same goes for topics and posts.

I’m pretty sure that every userid (and topic and post, and probably category) that exists in both the old and new databases is merged with the old one.

You’ll need to do something to see that the import_ids don’t conflict (maybe delete the old ones, maybe change the import script to make them unique for each import).

4 Likes

well… they ARE the same anyhow??
i mean it’s basically the same forum, only one part went on, and the other part stayed frozen in time. So user ID 123 is still user ID 123, and post and topic id’s as well?

what do you mean by import_id custom fields?

the forum looks ok, all topic, posts etc in place. that they are merged is the general idea?

I can’t find any other issues with other users/posts/topics except that one use case?

to explain perhaps better what is the case.

start was one phpbb forum. At some point in time I cloned it. one clone remained closed and became the archive. The other part, I deleted the oldest posts (that were now in the archive) and kept open. In that one, the users, topics, posts etc just increased and never were changed (ID-wise). So what I thought is that the import script will just see the archive and current forum as two parts of the same database, because they are… and treats it as an incremental import. And it has?

So, please help me understand now what’s gone wrong in your eyes because what you point out is exactly what I wanted it to do…

If the second forum was a superset of the first one, then I don’t see why you imported them both, but as long as the new forum doesn’t use any of the same user, post, or topic ids as the first one you should be ok.

When a user, topic, post is imported a XxxCustomField is created with name “import_id” so that you can tell the mapping from the old forum to the new one.

Some importers will also create an import_username custom field if the username changes. You can do something like

cd /var/discourse
rails c
u=User.find_by_username('username-youwant')
u.custom_fields

to see them.

1 Like

because I wanted the archived part merged back into the whole forum again, instead of having two “halves” of one forum. Now I don’t need to upkeep a separate ancient phpbb2 archive that I had to convert to discourse in some way or another… now its whole again :slight_smile: (we did the archive in an effort to reduce server load back in those days).

I tried your query, thank you,
for the usecase in my post I got {"import_id"=>"21293"} for NewName
and for OldName1 it did
{"import_id"=>"8800", "import_username"=>"OldName"}
so, wow it shows what it did there… Any reason why it decided that import_id8800 belonged to import username NewName? since they have different import_ID’s

Is there a way to do a more generic search because I don’t know what users are affected, that’s what I’m trying to figure out, so I don’t know the username-youwant part.

One way to do this would be:

  • Restore to the backup taken right after completing the archive import.
  • Wipe the import_id values from posts, topics, categories, and users.
  • Perform the current-forum import.

When you do this, users should get matched & combined by email.

3 Likes

Right. They have different import_ids, but the same username. If you want them to be the same user, they’ll need to have the same username (or you can contrive for them to have the same import_id).

Maybe search for

User.where("username like '%1'")

That’ll also catch people who just happened to want to end their username with a 1. .

And that will work perfectly . . . unless their email addresses changed.

However you got about it, you’ll have some stuff like this to resolve by hand.

1 Like

Quite useful. I am moving my gaming forum to discord. The PHPbb hosting (this one: https://www.cloudways.com/en/phpbb-hosting.php ) that I was using doesnt support apps other than PHP. So, I am in the process of exploring another platform for that.