HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

How to Duplicate Your Forum or Move it to Another Directory

edited August 2012 in Feedback

We recently launched a brand new product and needed a brand new forum for it.

Instead of reconfiguring a new Vanilla installation from scratch, I decided to duplicate my existing installation, move it to a new directory, and clear the contents so I'd have a brand new forum for the new product while doing much less work.

So here are the steps I took. Please let me know if this guide is helpful (or if you have any suggestions for something I didn't do).

Create a new directory and duplicate the database

  1. Use an FTP program to download the entirety of your forum subdirectory from your server. The VERY IMPORTANT thing I missed the first time around is not copying the .htaccess file.

  2. Create a new subdirectory on your server. Copy the material you downloaded in step 1 into this subdirectory. (DON'T FORGET TO COPY THE .htaccess FILE!)

  3. Delete all the .ini files in your cache folder. (Don't delete any of the other files -- be careful, this can Bonk your forum.)

  4. If you're just moving your forum from one subdirectory to another, you're done! If you're duplicating your forum, keep going.

  5. Create a new MySQL database. If you don't remember how to do this, click here . Remember to record the database name, password, and the new username and password for the database.

  6. Go to conf/config.php in your new Vanilla subdirectory. Change the four settings under //Database with your new database name, password, username and password. You might also want to change some other configuration settings like the forum title.

  7. Open phpMyAdmin. Click on your old database in the sidebar on the left side.

  8. Click the Export tab. The default export settings should be fine. (You're exporting a SQL file. Doesn't have to be compressed, but it shouldn't matter anyway.) Click Go.

  9. Navigate to your new database. Click the Import tab.

  10. Browse to select the SQL file you downloaded in step 8. Again, the default import settings should be fine. Click Go.

  11. Now if you go to the URL of your new forum, everything from your old forum should be there, perfectly intact. In the next few steps, we're going to clear out all the old entries and start from (almost) scratch.

  12. At this point, to be safe, disable all active plugins. Take a screenshot of the Enabled plugins so you know which ones to turn back on later.

  13. Backup your forum's MySQL database. Why am I doing this, when I have the backup from step 8? Because I'm paranoid like that. If you need instructions, click here.

  14. Now we're going to delete all the data from all of our tables. Not as difficult as it sounds. After a year of running, I only had 20 or so tables with data in them.

  15. This step is so important I split it up into three sections.
    This is the critical step. If you don't do this step correctly, you'll mess up your forum. Good thing you have a backup, huh?

a) In phpMyAdmin, use the Empty command to empty unneeded tables. Here's a good guide for doing so: http://tamba2.org.uk/wordpress/empty-drop/
P.S. The Empty command in phpMyAdmin is the same as the truncate command in SQL.

b) IMPORTANT NOTE: Some of these tables should NOT be emptied.

c) Make sure NOT to delete yourself as a user from GDN_User. Other databases to definitely at least consider saving:

GDN_ActivityType
GDN_Category (probably need to keep General at least but I'm not positive on that)
GDN_Message (In case you want to keep some of the same messages on your new forum)
GDN_Permission
GDN_Role
GDN_User (don't delete yourself or you won't be able to log in!)
GDN_UserRole (again, make sure you don't delete the row assigned to you)

d) Don't bother emptying tables without records. In phpMyAdmin, you can sort the list of tables by how many records they contain, which makes this easier.

e) Here's the list of tables I ended up emptying/truncating. You can use this as an SQL statement if you want. Your install won't have UserMeta unless you have the EMailSubscribe addon installed (which is highly recommended!):

TRUNCATE GDN_UserDiscussion;
TRUNCATE GDN_Activity;
TRUNCATE GDN_AnalyticsLocal;
TRUNCATE GDN_Comment;
TRUNCATE GDN_Discussion;
TRUNCATE GDN_UserMeta;
TRUNCATE GDN_Media;
TRUNCATE GDN_UserConversation;
TRUNCATE GDN_ConversationMessage;
TRUNCATE GDN_Draft;
TRUNCATE GDN_Conversation;
TRUNCATE GDN_ThanksLog;
TRUNCATE GDN_Log;

f) Here's the list of tables I manually pruned:

GDN_User
GDN_UserRole
GDN_Category
GDN_Message

Section 2 - Almost There

  1. Clear all the .ini files in your cache directory one more time to be safe.

  2. Time to check out your brand-new(ish) forum! Everything working ok? Good, move on to the next step.

  3. Turn the plugins you turned off in step 12 back on. Reconfigure anything that might need to be reconfigured.

  4. Clear all the .ini files in your cache directory one more time to be safe.

  5. Enjoy your brand new forum!

Note 1: You may need to make changes to the contents of your .htaccess file. My .htaccess file was very generic, and I didn't have to change it at all.

Note 2: Don't forget to change all the titles and customized text to correspond with the title of your new forum (if you're changing titles, that is).

Issues I experienced:
Thankful People wouldn't turn back on. Turns out I had an old version. Updating to the latest version fixed it.

Conclusions

Ultimately, these steps weren't all that hard and they saved me a lot of configuration time. Now I've got two forums that work exactly the same way which should help when administering them later on.

I would love to hear feedback. Any steps you would've done differently? Did you use this guide and were you successful?

Good luck!

-Alex

Comments

  • emziemzi
    edited August 2012

    @digitalguy said:

    Instead of reconfiguring a new Vanilla installation from scratch, I decided to duplicate my existing installation, move it to a new directory, and clear the contents so I'd have a brand new forum for the new product while doing much less work...

    Your instruction is adventurous. I liked it. Likewise, Steps 1-11 are common for transferring a forum from host to local host and vice-versa.

    digitalguy said:
    I would love to hear feedback. Any steps you would've done differently?



    1. Downloading Vanilla
    2, 3 and 4. Transferring it to the host, extracing the "zip" file and renaming the "vanilla" folder
    5. Creating a new database
    6. Opening the URL in a browser and continuing one-step installation
    7 and 8. Copying "plugins" and/or "themes" folders from directory of the old forum, then replacing them in this new one.
    *. I Think this takes much less time, dosen't it? Your instruction would be great if you try to keep GDN_User completely. However, in this case:
    9 and 10. Exporting essential tables from the old forum and importing to this one :)

  • peregrineperegrine MVP
    edited August 2012

    @Zoie

    advantage of @digitalguy's - truncating tables is less to keep track of then importing individual tables.

    if you have plugins that create their own tables e.g. karma, aboutme tags, etc. you have to keep track of each table.

    also if you import user table in your method Zoie - you will also need to transfer the uploads directory so user pics, thumnails etc are intact.

    Overall - Both methods you guys posted are great documentation

    I'll add a third wrinke for comments. - all permutations in one thread.

    I f you wanted to create two installations e.g. you had 2.0.17 running and you wanted a test 2.0.18 (or vanilla 2.1)

    0) backup database and source directory.
    1) download and extract 2.0.18 source code into a new directory.
    2) export 2.0.17 database.
    3) copy config.php from 2.017  and copy into 2.0.18
    4) change user host password in config.php in 2.0.18
    5) create new database vanilla2 and create user and permissions to reflect what is in 2.0.18 config.php
    6) import data from 2.0.17 exported database into new vanilla2 database. 
    7) copy over necessary plugins, customized themes, uploads folder
    8) set permissions correctly on cache and uploads folder.
    9) start new vanilla 2.0.18 with 
    
    www.yourforum.com/yournewforum218/index.php?p=/utility/update
    
    10) you are good to go.
    
    
    note: I don't know if /utility/update of a 2.18 database will work with vanilla 2.1
    Can anybody confirm or deny it Vanilla 2.1 can successfully upgrade a 2.18 database.
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • AaronWebsteyAaronWebstey Headband Afficionado Cole Harbour, NS ✭✭✭

    This is also a very handy guide for setting up a development version of your forum - just stop once you get to step 11. Now I can test themes, plugins, etc without messing my users up.

Sign In or Register to comment.