Advertisement:

Author Topic: [TIP] How to Merge one SMF Forum with Another using MySQL  (Read 25529 times)

Offline Herman's Mixen

  • SMF Hero
  • ******
  • Posts: 7,228
    • Herman's Mixen
Re: [TIP] How to Merge one SMF Forum with Another using MySQL
« Reply #20 on: September 19, 2012, 06:17:58 PM »
diggin into my hard drives ;)

found this tiny old scripty wich was written by Oldiesmann for SMF 1.0.x rewritten by Resourzes for 1.1.x
for 2.0.x it needs a bit of tweaking but its useable ;)

Read the discriptions inside that file !!
« Last Edit: September 20, 2012, 04:35:42 AM by Poύνικ »
Met vriendelijke groet, The Burglar!

 House Mixes | Mixcloud | Any Intelligent fool can make things bigger, more complex, and more violent.
It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Albert Einstein

Former Godfather of our dutch community ;)

Offline OnThePike

  • Newbie
  • *
  • Posts: 4
Re: [TIP] How to Merge one SMF Forum with Another using MySQL
« Reply #21 on: September 20, 2012, 12:55:58 AM »
Thank you for the reply, but unfortunately, I'm not experienced enough in PHP to know exactly what should be tweaked, and where. I ran the script as-is, uncommented the member update steps, but the script failed nonetheless. Here's the list of errors. perhaps you, or someone else can further assist?

Code: [Select]
[Thu Sep 20 00:19:10 2012] [error] [client 127.0.0.1] PHP Warning:  mysql_result() expects parameter 1 to be resource, boolean given in I:\\wamp\\www\\convert\\mergeSMF.php on line 69, referer: http://localhost/convert/mergeSMF.php
[Thu Sep 20 00:19:10 2012] [error] [client 127.0.0.1] PHP Warning:  mysql_free_result() expects parameter 1 to be resource, boolean given in I:\\wamp\\www\\convert\\mergeSMF.php on line 70, referer: http://localhost/convert/mergeSMF.php
[Thu Sep 20 00:19:10 2012] [error] [client 127.0.0.1] PHP Warning:  mysql_result() expects parameter 1 to be resource, boolean given in I:\\wamp\\www\\convert\\mergeSMF.php on line 90, referer: http://localhost/convert/mergeSMF.php
[Thu Sep 20 00:19:10 2012] [error] [client 127.0.0.1] PHP Warning:  mysql_free_result() expects parameter 1 to be resource, boolean given in I:\\wamp\\www\\convert\\mergeSMF.php on line 91, referer: http://localhost/convert/mergeSMF.php
[Thu Sep 20 00:19:14 2012] [error] [client 127.0.0.1] PHP Warning:  mysql_result() expects parameter 1 to be resource, boolean given in I:\\wamp\\www\\convert\\mergeSMF.php on line 112, referer: http://localhost/convert/mergeSMF.php
[Thu Sep 20 00:19:14 2012] [error] [client 127.0.0.1] PHP Warning:  mysql_free_result() expects parameter 1 to be resource, boolean given in I:\\wamp\\www\\convert\\mergeSMF.php on line 113, referer: http://localhost/convert/mergeSMF.php
[Thu Sep 20 00:19:35 2012] [error] [client 127.0.0.1] PHP Warning:  mysql_result() expects parameter 1 to be resource, boolean given in I:\\wamp\\www\\convert\\mergeSMF.php on line 136, referer: http://localhost/convert/mergeSMF.php?step=2
[Thu Sep 20 00:19:35 2012] [error] [client 127.0.0.1] PHP Warning:  mysql_free_result() expects parameter 1 to be resource, boolean given in I:\\wamp\\www\\convert\\mergeSMF.php on line 137, referer: http://localhost/convert/mergeSMF.php?step=2
[Thu Sep 20 00:19:42 2012] [error] [client 127.0.0.1] PHP Warning:  mysql_result() expects parameter 1 to be resource, boolean given in I:\\wamp\\www\\convert\\mergeSMF.php on line 166, referer: http://localhost/convert/mergeSMF.php?step=3
[Thu Sep 20 00:19:42 2012] [error] [client 127.0.0.1] PHP Warning:  mysql_free_result() expects parameter 1 to be resource, boolean given in I:\\wamp\\www\\convert\\mergeSMF.php on line 167, referer: http://localhost/convert/mergeSMF.php?step=3
[Thu Sep 20 00:19:42 2012] [error] [client 127.0.0.1] PHP Warning:  mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in I:\\wamp\\www\\convert\\mergeSMF.php on line 170, referer: http://localhost/convert/mergeSMF.php?step=3
[Thu Sep 20 00:19:42 2012] [error] [client 127.0.0.1] PHP Warning:  mysql_free_result() expects parameter 1 to be resource, boolean given in I:\\wamp\\www\\convert\\mergeSMF.php on line 192, referer: http://localhost/convert/mergeSMF.php?step=3
[Thu Sep 20 00:19:49 2012] [error] [client 127.0.0.1] PHP Warning:  mysql_result() expects parameter 1 to be resource, boolean given in I:\\wamp\\www\\convert\\mergeSMF.php on line 266, referer: http://localhost/convert/mergeSMF.php?step=4
[Thu Sep 20 00:19:49 2012] [error] [client 127.0.0.1] PHP Warning:  mysql_free_result() expects parameter 1 to be resource, boolean given in I:\\wamp\\www\\convert\\mergeSMF.php on line 267, referer: http://localhost/convert/mergeSMF.php?step=4
[Thu Sep 20 00:19:49 2012] [error] [client 127.0.0.1] PHP Warning:  mysql_result() expects parameter 1 to be resource, boolean given in I:\\wamp\\www\\convert\\mergeSMF.php on line 285, referer: http://localhost/convert/mergeSMF.php?step=4
[Thu Sep 20 00:19:49 2012] [error] [client 127.0.0.1] PHP Warning:  mysql_free_result() expects parameter 1 to be resource, boolean given in I:\\wamp\\www\\convert\\mergeSMF.php on line 286, referer: http://localhost/convert/mergeSMF.php?step=4
[Thu Sep 20 00:19:52 2012] [error] [client 127.0.0.1] PHP Warning:  mysql_result() expects parameter 1 to be resource, boolean given in I:\\wamp\\www\\convert\\mergeSMF.php on line 308, referer: http://localhost/convert/mergeSMF.php?step=7
[Thu Sep 20 00:19:52 2012] [error] [client 127.0.0.1] PHP Warning:  mysql_free_result() expects parameter 1 to be resource, boolean given in I:\\wamp\\www\\convert\\mergeSMF.php on line 309, referer: http://localhost/convert/mergeSMF.php?step=7
[Thu Sep 20 00:19:57 2012] [error] [client 127.0.0.1] PHP Warning:  mysql_fetch_row() expects parameter 1 to be resource, boolean given in I:\\wamp\\www\\convert\\mergeSMF.php on line 332, referer: http://localhost/convert/mergeSMF.php?step=8
[Thu Sep 20 00:19:57 2012] [error] [client 127.0.0.1] PHP Warning:  mysql_free_result() expects parameter 1 to be resource, boolean given in I:\\wamp\\www\\convert\\mergeSMF.php on line 337, referer: http://localhost/convert/mergeSMF.php?step=8
[Thu Sep 20 00:29:46 2012] [error] [client 127.0.0.1] PHP Warning:  mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in I:\\wamp\\www\\convert\\mergeSMF.php on line 170, referer: http://localhost/convert/mergeSMF.php?step=3
[Thu Sep 20 00:29:46 2012] [error] [client 127.0.0.1] PHP Warning:  mysql_free_result() expects parameter 1 to be resource, boolean given in I:\\wamp\\www\\convert\\mergeSMF.php on line 192, referer: http://localhost/convert/mergeSMF.php?step=3
[Thu Sep 20 00:30:10 2012] [error] [client 127.0.0.1] File does not exist: I:/wamp/www/gallery, referer: http://localhost/forum/index.php
[Thu Sep 20 00:30:41 2012] [error] [client 127.0.0.1] File does not exist: I:/wamp/www/gallery, referer: http://localhost/forum/index.php
[Thu Sep 20 00:36:17 2012] [error] [client 127.0.0.1] File does not exist: I:/wamp/www/gallery, referer: http://localhost/forum/index.php
[Thu Sep 20 00:37:46 2012] [error] [client 127.0.0.1] PHP Warning:  mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in I:\\wamp\\www\\convert\\mergeSMF.php on line 170, referer: http://localhost/convert/mergeSMF.php?step=3
[Thu Sep 20 00:37:46 2012] [error] [client 127.0.0.1] PHP Warning:  mysql_free_result() expects parameter 1 to be resource, boolean given in I:\\wamp\\www\\convert\\mergeSMF.php on line 192, referer: http://localhost/convert/mergeSMF.php?step=3
[Thu Sep 20 00:38:20 2012] [error] [client 127.0.0.1] File does not exist: I:/wamp/www/gallery, referer: http://localhost/forum/index.php
[Thu Sep 20 00:43:45 2012] [error] [client 127.0.0.1] PHP Warning:  mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in I:\\wamp\\www\\convert\\mergeSMF.php on line 170, referer: http://localhost/convert/mergeSMF.php?step=3
[Thu Sep 20 00:43:45 2012] [error] [client 127.0.0.1] PHP Warning:  mysql_free_result() expects parameter 1 to be resource, boolean given in I:\\wamp\\www\\convert\\mergeSMF.php on line 192, referer: http://localhost/convert/mergeSMF.php?step=3
[Thu Sep 20 00:43:51 2012] [error] [client 127.0.0.1] PHP Fatal error:  Call to undefined function db_query() in I:\\wamp\\www\\convert\\mergeSMF.php on line 215, referer: http://localhost/convert/mergeSMF.php?step=4
[Thu Sep 20 00:44:30 2012] [error] [client 127.0.0.1] PHP Fatal error:  Call to undefined function db_query() in I:\\wamp\\www\\convert\\mergeSMF.php on line 215

Offline Herman's Mixen

  • SMF Hero
  • ******
  • Posts: 7,228
    • Herman's Mixen
Re: [TIP] How to Merge one SMF Forum with Another using MySQL
« Reply #22 on: September 20, 2012, 03:42:17 AM »
This script goes into the secondary forum root where the Settings.php and SSI.php are in the root of that forum, the primary forum will be the merged forums...

Also wich version of SMF you would merge i.e : 1.0.x, 1.1,x or SMF 2.x only for SMF 2.x it needs to tweaked to work with SMF 2.x installations...

Code: [Select]
define('PRIMARY_DB_PREFIX', 'smf_');

change smf_ to your prefix which is used on the DB of the primary forum

then you can run it as hxxp://www.domain.tld/forum/mergeSMF.php from the secondary SMF installation
Met vriendelijke groet, The Burglar!

 House Mixes | Mixcloud | Any Intelligent fool can make things bigger, more complex, and more violent.
It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Albert Einstein

Former Godfather of our dutch community ;)

Offline BryanD

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 22,021
  • Gender: Male
    • BryanRunicDeakin on Facebook
    • @bryandeakin on Twitter
    • Bryan Deakin dot Com
Re: [TIP] How to Merge one SMF Forum with Another using MySQL
« Reply #23 on: September 20, 2012, 04:36:12 AM »
The Burglar, you need to get permission from Oldies to post that sorry

Offline Herman's Mixen

  • SMF Hero
  • ******
  • Posts: 7,228
    • Herman's Mixen
Re: [TIP] How to Merge one SMF Forum with Another using MySQL
« Reply #24 on: September 20, 2012, 04:51:52 AM »
Oops didn't know that thought it was a community wide tool back in the days... anyway thx for the info bryan
Met vriendelijke groet, The Burglar!

 House Mixes | Mixcloud | Any Intelligent fool can make things bigger, more complex, and more violent.
It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Albert Einstein

Former Godfather of our dutch community ;)

Offline OnThePike

  • Newbie
  • *
  • Posts: 4
Re: [TIP] How to Merge one SMF Forum with Another using MySQL
« Reply #25 on: September 20, 2012, 05:29:22 AM »
Here's some detailed background:

I am currently trying to merge two SMF 2.0.2 forums.

The older, original board began as phpBB 2.0.4, updated to 2.0.11, then upgraded to phpBB 3.0.10. From there, it was converted to SMF 2.0.2 and resides in the path /home/local/public_html/convert/.

My current (primary) forum began as SMF 1.0.4, was updated to 1.1.16, then upgraded to 2.0.2. This forum resides in /home/local/public_html/forum/.

Via localhost, both boards share the same database (for merging purposes). The "convert" table prefix is phpbbsmf_ while the "forum" table prefix is smf_.

The merge script you posted (but has since been removed) was placed in, and executed from /convert/ which is the secondary forum. However, let me reiterate: I had already successfully merged these two forums into one primary SMF forum, however the result was unsatisfactory because the old topic ID numbers were more recent than the current forum topic ID's which placed the ancient topics above the current topics as "most recent". I could solve this issue if there was a way to default topic display to topic_date instead of topic_id, but to my knowledge, this isn't possible. Finally, none of the available topic display mods allow or offer a date function.

Each board has roughly 500 members. About half are duplicate members, half different between each. I was able to merge existing members into a single user account for each of those duplicates retaining all relevant data (posts, topics, private messages, etc). My problem and issue isn't the ability to merge -- it's the inability to display topics in date order. And that's the help I seek.

At this time, I have reverted both boards back to their independent SMF 2.0.2 state. I was thinking of attempting the merge from what is now primary to secondary, instead of the other way around. This would (should) retain proper topic_id display, but might cause other issues I haven't yet realized. So before I go that route, I'm here looking for a better method.

Assistance toward that end, in addition to the merge script 2.0.2 compatibility changes would be greatly appreciated :-)

Offline OnThePike

  • Newbie
  • *
  • Posts: 4
Re: [TIP] How to Merge one SMF Forum with Another using MySQL
« Reply #26 on: September 21, 2012, 12:58:19 AM »
The Burglar, you need to get permission from Oldies to post that sorry

Why? That script is publicly available by the author here:

hxxp:resourcez.donationspro.com/index.php?action=tpmod;dl=item7 [nonactive]

Offline bfeist

  • Semi-Newbie
  • *
  • Posts: 25
  • Gender: Male
  • Admin of temac.ca/smf
    • http://www.linkedin.com/in/feist on LinkedIn
    • @benfeist on Twitter
    • Articles and Interests
Re: [TIP] How to Merge one SMF Forum with Another using MySQL
« Reply #27 on: October 27, 2013, 06:54:35 PM »
diggin into my hard drives ;)

found this tiny old scripty wich was written by Oldiesmann for SMF 1.0.x rewritten by Resourzes for 1.1.x
for 2.0.x it needs a bit of tweaking but its useable ;)

Read the discriptions inside that file !!

Hi there. Can you give us any hints on what changes you had to make to make the script compatible with 2.0.x? Any help would be greatly appreciated.

Offline bfeist

  • Semi-Newbie
  • *
  • Posts: 25
  • Gender: Male
  • Admin of temac.ca/smf
    • http://www.linkedin.com/in/feist on LinkedIn
    • @benfeist on Twitter
    • Articles and Interests
Re: [TIP] How to Merge one SMF Forum with Another using MySQL
« Reply #28 on: November 02, 2013, 03:55:51 PM »
Hi all,
I've posted a tool that will merge two SMF forums here. Have a look.
http://www.simplemachines.org/community/index.php?topic=513684.msg3630822


Online Gwenwyfar

  • Customizer
  • Full Member
  • *
  • Posts: 690
  • Gender: Female
    • Gwenwyfar on GitHub
Re: [TIP] How to Merge one SMF Forum with Another using MySQL
« Reply #29 on: October 07, 2014, 09:09:44 AM »
Old post but: I ran this for boards + categories only, so that I could merge an scraped database into an existing smf install with categories/structure all set and organize it from there, and it worked just fine, but I don't see sub-sections anywhere. Is this something separate or this wasn't supposed to happen?

Well, if I find a solution to this I'll post it here later.

Edit: They were there and the topics were inside them, but they got lost in not knowing which section they belonged to. I ran a fix errors and all of them showed up on salvaged section, so they just need to be moved to their places later :)

Very nice tip, thanks for posting this! Will be very useful later for me, I'll be merging 3 forums together. Glad to see it works well.
« Last Edit: October 07, 2014, 10:29:57 AM by Fortytwo »

Online Gwenwyfar

  • Customizer
  • Full Member
  • *
  • Posts: 690
  • Gender: Female
    • Gwenwyfar on GitHub
Re: [TIP] How to Merge one SMF Forum with Another using MySQL
« Reply #30 on: December 15, 2014, 06:16:39 PM »
Doing the merge with the other 2 forums now, figured out the problem about child boards, its missing the id_parent for the boards.

So it would be UPDATE smf_boards SET ID_PARENT = ID_PARENT+91;
With the same number as the boards.
« Last Edit: December 15, 2014, 06:30:55 PM by Fortytwo »