Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: Neverhurry on May 22, 2010, 11:54:38 AM

Title: To clone whole forum to another site
Post by: Neverhurry on May 22, 2010, 11:54:38 AM
Hi, I have a problem. I need to split my forum into two parts, but I know that will be very difficult. So I would like to ask this question.

My forum is now at xyz.tld, and i want to extract all most half of the content (one board on photography) to abc.tld. So I can clone the whole forum from xyz.tld to abc.tld, and there in abc.tld i will manually delele all the topics and posts outside of that photography board, thus i will get a forum with only the photography board content, and the same members. Is it possible or simply a fantasy? If it is possible, how difficult is the clone process? Any help will be highly appreciated!!!
Title: Re: To clone whole forum to another site
Post by: CapadY on May 22, 2010, 12:02:52 PM
May you can start reading the next topic:

http://www.simplemachines.org/community/index.php?topic=382428.0
Title: Re: To clone whole forum to another site
Post by: busterone on May 22, 2010, 04:00:04 PM
I have done it, and it is really rather simple.
Copy the entire file structure of your original forum to your new domain's web space/directory. Export a backup of your active database. Import that backup to a new db on the new domain. Then upload repair_settings.php to the root of your new forum domain and run it from your browser. Ensure the DB info, urls and paths are correct, and even change the forum's name if you plan to. Once it is completed, you can log in to your new forum. Then go to admin- Themes Settings to make sure any other theme's urls and paths are correct as well. Repair_settings.php will repair the default theme urls and paths only. You must do the additional ones manually.
Then, IF you are using a recycle bin, it is advisable to disable it while you delete boards and topics. If not, it will make you work much harder and longer. Go into the Admin CP and simply delete all the boards that you want to eliminate, leaving only the photography board.
After all boards and topics are deleted, it is also advisable to run the admin db maintenance tasks. (optimize tables, check for errors, etc.) Then re-activate the recycle bin if you are using it.
You will have a new forum with the one photography board and retain all the members of the original forum.
Title: Re: To clone whole forum to another site
Post by: Neverhurry on May 22, 2010, 04:09:48 PM
Oh, thanks sooooooo much.

In "How do I restore the database data? " I read "The name of the new database should be the same name as the old database. " , but I can not have 2 databases with the same name in the same server (because I am not going to change host), that is the last thing which troubles me. busterone, when you did that, did you have to create a new database with the same name as the old database?
Title: Re: To clone whole forum to another site
Post by: flapjack on May 22, 2010, 04:16:25 PM
it's not possible to have two databases with the same name, however you could use one database and change the prefix of second installation from smf_ to something else.

HOWEVER, this will need some precautions and supervision to make it work. if you decide to give it a go today, I will be happy to assist you with it (I have some time to spare), let me know. (FYI: I've done it multiple times with 100% success rate)

if you decide not to go for it, here's the outline what you have to do:
- make a backup of the database (or two of them, just in case)
- get some proper text editor  (like Notepad++)
- replace all smf_ prefixes with other (for example smf2_) in tables names. keep in mind that if you are using any mods, there might be some problems (I am refering to Aeva Media here, which I remember gave me some trouble before)
- using ftp software create a copy of your current installation
- import changed database
- use repair_settings.php
- fix your attachments/avatars path, themes path, and smileys
- enjoy your newly created copy :)
Title: Re: To clone whole forum to another site
Post by: Neverhurry on May 22, 2010, 05:07:10 PM
Wow, you are so friendly. I will give it try tomorrrow since it is too late. Bed time now. But thanks so much for the useful suggestion. Good nite.
Title: Re: To clone whole forum to another site
Post by: Neverhurry on May 23, 2010, 11:39:47 AM
flapjack,  why is that "replace all smf_ prefixes with other (for example smf2_) in tables names", I thought there is no need to change the prefixes.
Title: Re: To clone whole forum to another site
Post by: flapjack on May 23, 2010, 11:52:34 AM
well, you either use two databases or one with both forums using different prefixes. you cannot just merge tables, as this will make your forum unusable
Title: Re: To clone whole forum to another site
Post by: Neverhurry on May 23, 2010, 01:38:11 PM
While import the sql file i got this error:

Error

SQL query:

INSERT INTO `smf_log_search_subjects` (`word`, `id_topic`) VALUES ('xxxx', 426), ('xxxx', 121), ('xxxx', 88), ('xxxx', 2137), ('xxxx', 747), ('xxxx', 598), ('xxxx', 1942), ('xxxx', 1511), ('xxxx', 1717), ('xxxx', 1584), ('xxxx', 592), ('xxxx', 1667), ('xxxx', 1104), ('xxxx(一', 1490), ('xxxx ', 1162), ('xxxx', 45), ('xxxx', 1766), ('xxxx', 1415), ('xxxx', 1982), ('xxxx', 1657), ('xxxx', 1611), ('xxxx', 803), ('xxxx', 807), ('xxxx', 1889), ('xxxx', 1835), ('xxxx', 1641), ('xxxx', 2077), ('xxxx', 818), ('xxxx', 1567), ('xxxx', 1768), ('xxxx?', 2113), ('xxxx', 55), ('xxxx', 1484), ('xxxx', 979), ('�[...]

MySQL said: Documentation
#1062 - Duplicate entry '?-807' for key 1


Can anybody help me?
Title: Re: To clone whole forum to another site
Post by: Neverhurry on May 23, 2010, 01:59:10 PM
I tried another way: export database to a sql file and then import this file to the new db by phpMyAdmin, but i had this error:

Error

SQL query:

-- -- Dumping data for table `smf_admin_info_files` -- INSERT INTO `smf_admin_info_files` (`id_file`, `filename`, `path`, `parameters`, `data`, `filetype`) VALUES (1, 'current-version.js', '/smf/', 'version=%3$s', 'window.smfVersion = "SMF 2.0 RC3";', 'text/javascript'), (2, 'detailed-version.js', '/smf/', 'language=%1$s&version=%3$s', 'window.smfVersions = {\n ''SMF'': ''SMF 2.0 RC3'',\n ''SourcesAdmin.php'': ''2.0 RC3'',\n ''SourcesBoardIndex.php'': ''2.0 RC3'',\n ''SourcesCalendar.php'': ''2.0 RC3'',\n ''SourcesClass-Graphics.php'': ''2.0 RC3'',\n ''SourcesClass-Package.php'': ''2.0 RC3'',\n ''SourcesDbExtra-mysql.php'': ''2.0 RC3'',\n ''SourcesDbExtra-postgresql.php'': ''2.0 RC3'',\n ''SourcesDbExtra-sqlite.php'': ''2.0 RC3'',\n ''SourcesDbPackages-mysql.php'': ''2.0 RC3'',\n ''SourcesDbPackages-postgresql.php'': ''2.0 RC3'',\n ''SourcesDbPackages-sqlite.php'': ''2.0 RC3'',\n ''SourcesDbSearch-mysql.php'': ''2.0 RC3'',\n ''SourcesDbSearch-postgresql.php'': ''2.0 RC3'',\n ''Sourc[...]

MySQL said: Documentation
#1062 - Duplicate entry '1' for key 1


If somebody knows how to solve this problem, please help! Thank you!
Title: Re: To clone whole forum to another site
Post by: flapjack on May 23, 2010, 02:39:30 PM
what software are you using to edit files?
Title: Re: To clone whole forum to another site
Post by: Neverhurry on May 23, 2010, 02:53:47 PM
I use EditPlus, it should be safe. I read that it may have something to do with the tables auto increment value.
http://www.simplemachines.org/community/index.php?topic=328941.0
Title: Re: To clone whole forum to another site
Post by: CapadY on May 23, 2010, 05:05:18 PM
Are you sure the tables are empty before restoring the data ?

You don't try to restore the same table twice ?

This is an problem with keyfields. Often a auto-increment field but can be other.
Title: Re: To clone whole forum to another site
Post by: Neverhurry on May 23, 2010, 05:26:56 PM
Quote from: capady on May 23, 2010, 05:05:18 PM
Are you sure the tables are empty before restoring the data ?

You don't try to restore the same table twice ?

This is an problem with keyfields. Often a auto-increment field but can be other.

thanks.
I had been importing to an empty database, so no twice issue.
I deleted all the smf_log_search_subjects tables, and it is successful.

But I have another language problem.  :'( Look:

http://www.simplemachines.org/community/index.php?topic=383042.0;topicseen