Merge two phpbb3 forums

Converting from other board software? Good decision! Need help? Have a question about a convertor? Wish to offer a convertor package? Post here.
Scam Warning
User avatar
Jackanape
Registered User
Posts: 1076
Joined: Wed Oct 13, 2004 6:01 am
Location: Capitol of the Great State of New York
Name: Jack Drury
Contact:

Re: Merge two phpbb3 forums

Post by Jackanape » Wed Feb 27, 2013 7:39 pm

This topic is a gem...I'm giving this a try tonight/tomorrow, after a few small test runs, and will be back with anything new I can report.

I'm going to be merging a forum with some considerable attachments, and am fiddling with trying to get them all reattached to the proper posts/topics, but may end up abandoning the idea altogether. Has anyone had any success with this?
~Extending the rule of meticulous exactitude to exaspirating punctillio...still.~
Treat your phpBB like a member of the family--Update and MOD her by hand, with HTML-Kit
: : Wanna Talk Poker? : : Image : :

User avatar
abertoll
Registered User
Posts: 84
Joined: Fri Jan 21, 2005 5:13 am
Contact:

Re: Merge two phpbb3 forums

Post by abertoll » Wed Feb 27, 2013 7:43 pm

I had no success. Frankly the phpBB database is just too complex and without foreign key enforcement in the database it's a super hard task for any forums of significant size.

User avatar
Jackanape
Registered User
Posts: 1076
Joined: Wed Oct 13, 2004 6:01 am
Location: Capitol of the Great State of New York
Name: Jack Drury
Contact:

Re: Merge two phpbb3 forums

Post by Jackanape » Wed Feb 27, 2013 8:04 pm

Thanks for the feedback...I was just doing some theorizing...it seems if we add a column for old_post_id and old_topic_id, to the source tables, as we do for the user_id tables, we can update the attachments backup as we go along...it's a big nut, but I think it's worth it, especially with large forums...
~Extending the rule of meticulous exactitude to exaspirating punctillio...still.~
Treat your phpBB like a member of the family--Update and MOD her by hand, with HTML-Kit
: : Wanna Talk Poker? : : Image : :

User avatar
abertoll
Registered User
Posts: 84
Joined: Fri Jan 21, 2005 5:13 am
Contact:

Re: Merge two phpbb3 forums

Post by abertoll » Wed Feb 27, 2013 8:52 pm

Well the problem is with id collisions right? What I was doing was trying to automatically increase one forum by X on IDs based on the last ID of the previous forum.

If you want I can send you the code I had when I was trying to do it. I forget, can I attach that here?

User avatar
abertoll
Registered User
Posts: 84
Joined: Fri Jan 21, 2005 5:13 am
Contact:

Re: Merge two phpbb3 forums

Post by abertoll » Wed Feb 27, 2013 9:29 pm

Here is the script I was working on to try to automatically do the migration. keymap.php is my way of trying to keep track of which items need to be updated across the database (my replacement for foreign keys).

It's been a while since I looked at it. It shouldn't touch the two original forums, but just in case make backups first.
Attachments
merge-script.zip
Unfinished merge script
(5.86 KiB) Downloaded 114 times

User avatar
Black Antitoon
Registered User
Posts: 219
Joined: Mon Dec 25, 2006 12:12 pm
Contact:

Re: Merge two phpbb3 forums

Post by Black Antitoon » Wed Feb 27, 2013 11:11 pm

I have done it. I wanted to write a good tutorial that the extends bruder's instruction but never found time for doing so (including the merging of other stuff like drafts, bookmarks and fixing the problem with multi-recipient PMs).
I will retrieve and post the relevant stuff, including the script for migrating the attachments again, tomorrow evening if I am still alive. :P
Do you recognise my avatar? :)

User avatar
Jackanape
Registered User
Posts: 1076
Joined: Wed Oct 13, 2004 6:01 am
Location: Capitol of the Great State of New York
Name: Jack Drury
Contact:

Re: Merge two phpbb3 forums

Post by Jackanape » Fri Mar 01, 2013 4:26 pm

Attachments work, and it's actually pretty easy, pretty much following the original instructions here:

Backed up phpbb_attachments with phpbb_attachments_2

Now, when it was time to update all the user_ids, I added this bit:
update phpbb_attachments_2 set poster_id = poster_id + [number of users to add];

After the duplicate users were found and the old_id was populated, and the user information in the tables is replaced:

update phpbb_attachments_2, phpbb_users_2
set phpbb_attachments_2.poster_id = phpbb_users_2.user_id where phpbb_attachments_2.poster_id = phpbb_users_2.user_id_old;

Then, it's on to the topics and posts:

update phpbb_attachments_2 set topic_id = topic_id + [number to add];
update phpbb_attachments_2 set post_msg_id = post_msg_id + [number to add];

Then we have to deal with the new Attachment Table:

SELECT MAX( attach_id ) FROM phpbb_attachments; --> remember 2392 (I had a big forum)

ALTER TABLE phpbb_attachments_2 CHANGE `attach_id` `attach_id` MEDIUMINT( 8 ) UNSIGNED NOT NULL;
alter table phpbb_attachments_2 drop primary key;

update phpbb_attachments_2 set attach_id = attach_id + 2392;

For the final merge:

INSERT INTO phpbb_attachments (attach_id, post_msg_id, topic_id, in_message, poster_id, is_orphan, physical_filename, real_filename, download_count, attach_comment, extension, mimetype, filesize, filetime, thumbnail)
select attach_id, post_msg_id, topic_id, in_message, poster_id, is_orphan, physical_filename, real_filename, download_count, attach_comment, extension, mimetype, filesize, filetime, thumbnail from phpbb_attachments_2;

And attachments were successfully merged as well! (I also merged the medals table, and the custom profile fields tables, all in the same manner...this how to is one of the best ever put out on this topic.)

Now, I ran into a problem with my left and right ids in the forums tables, as they are no longer allowed to be the same. So, I ran an extra query for each one as in the instructions. The forums were still off, so I used the Support Toolkit:
https://www.phpbb.com/support/stk/

And it fixed it up round.

I'm going out to celebrate with a beer. I hope this helped everyone! Cheers!
~Extending the rule of meticulous exactitude to exaspirating punctillio...still.~
Treat your phpBB like a member of the family--Update and MOD her by hand, with HTML-Kit
: : Wanna Talk Poker? : : Image : :

User avatar
Black Antitoon
Registered User
Posts: 219
Joined: Mon Dec 25, 2006 12:12 pm
Contact:

Re: Merge two phpbb3 forums

Post by Black Antitoon » Sat Mar 02, 2013 12:33 am

Congratulations. :)

I am posting some instructions anyway for the people coming and for you if you find them useful.

The following procedure begins with bruder's merging procedure, thus merges:
  • Forums, topics and posts
  • Users
  • Private messages
Additionally:
  • The problem with multiple-recipients PMs is fixed by a script (with the old procedure they would display the wrong recipient in the sender's outbox).
  • Attachments. It requires file renaming, a small renaming tool is provided for that. Thumbnails for attached images are also merged.
  • Avatars
  • Polls
  • Drafts
  • Bookmarks
I know that some of this things like, say, bookmarks are perhaps not the most important thing, but since it's just a couple of SQL queries why not merging them as well?

Sooner or later I will compile a full guide for doing that. In the meantime I am just uploading the raw txt files onto which I noted down the steps for these operations.

Please note that later I discovered some minor issues which I have fixed in some way and I don't remember all of them.

Attached is the zip file with the txt with instruction and the scripts required for some of the steps.

Have fun! :)
Attachments
Steps_tools.zip
(35.12 KiB) Downloaded 285 times
Last edited by Black Antitoon on Sat Mar 02, 2013 11:41 pm, edited 1 time in total.
Do you recognise my avatar? :)

User avatar
Jackanape
Registered User
Posts: 1076
Joined: Wed Oct 13, 2004 6:01 am
Location: Capitol of the Great State of New York
Name: Jack Drury
Contact:

Re: Merge two phpbb3 forums

Post by Jackanape » Sat Mar 02, 2013 8:15 pm

One thing I forgot to tackle, and SHOULD have...

phpbb_user_groups table.

So, instead, I vacated all of my groups, and just resynced my registered users and newly registered users with STK.

So, I recommend this to anyone considering this with large forums...
~Extending the rule of meticulous exactitude to exaspirating punctillio...still.~
Treat your phpBB like a member of the family--Update and MOD her by hand, with HTML-Kit
: : Wanna Talk Poker? : : Image : :

MaFeSa
Registered User
Posts: 174
Joined: Wed Feb 11, 2009 7:48 am

Re: Merge two phpbb3 forums

Post by MaFeSa » Tue Mar 19, 2013 7:01 pm

Thanks to everyone, following the guide of Black Antitoon I merged 3 phpBB forums!

Thanks again

User avatar
Black Antitoon
Registered User
Posts: 219
Joined: Mon Dec 25, 2006 12:12 pm
Contact:

Re: Merge two phpbb3 forums

Post by Black Antitoon » Tue Mar 19, 2013 10:36 pm

That's great news! :)

If you noticed any mistakes in the guide or any extra steps that you needed to take, please share them with us. ;)
Do you recognise my avatar? :)

zbuzanic
Registered User
Posts: 14
Joined: Mon Mar 20, 2006 2:32 pm

Re: Merge two phpbb3 forums

Post by zbuzanic » Wed Jul 24, 2013 2:50 pm

WoW! :)

First I had to convert Yabb 2.5.2 to SMF 2.x, so I used http://download.simplemachines.org/?con ... tware=yabb (Yabb 2.2 to SMF 2-0)

Then SMF to clean phpBB3

and today finally I merged that phpBB3 to my pbpBB3 and it worked great!

Nice tutorial from first page, seems difficult but it takes 30 mins and is really easy afterall :)

elemor
Registered User
Posts: 4
Joined: Mon Oct 26, 2009 7:54 pm

Re: Merge two phpbb3 forums

Post by elemor » Sun Jun 01, 2014 6:15 am

Is it possible to combine 3 forum? At least for the merge process as STK Phpbb Do you have a regular system?

User avatar
Jackanape
Registered User
Posts: 1076
Joined: Wed Oct 13, 2004 6:01 am
Location: Capitol of the Great State of New York
Name: Jack Drury
Contact:

Re: Merge two phpbb3 forums

Post by Jackanape » Mon Jun 02, 2014 1:36 am

Absolutely. Merge the first two, then merge that one with the third. It works like a charm!
~Extending the rule of meticulous exactitude to exaspirating punctillio...still.~
Treat your phpBB like a member of the family--Update and MOD her by hand, with HTML-Kit
: : Wanna Talk Poker? : : Image : :

andrew55
Registered User
Posts: 236
Joined: Wed Jan 28, 2009 7:43 pm

Re: Merge two phpbb3 forums

Post by andrew55 » Thu Oct 30, 2014 7:23 am

I am very happy to have found this post. Thanks to all who contributed.

I have two boards I need to merge together. Both are in 3.0.11

I do have several uses who are on both boards (same email, username, etc), and if possible, I would like the same users (with their posts, etc) to exists as one user in the final forum.

I saw on the first page of this topic how to deal with this. Is this still the best method?

The guide from Black Antitoon seems to be the most updated approach, although I didn't see anything about duplicate users in the guide. To merge the same users into one, do I use the instructions in that guide and somehow try to also apply the steps on the first page of this topic?

Thanks for any suggestions.

Locked

Return to “[3.0.x] Convertors”